Windows 10 远程桌面开启
1、将下面的代码复制到新建文本文档中,将文本文档的后缀名修改为.bat格式,运行此文件即可关闭远程桌面;
@echo off
::获取管理员权限
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
::启用远程桌面
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
::关闭防火墙
::netsh firewall set opmode mode=disable
netsh advfirewall set currentprofile state off
::禁用不允许空密码远程访问
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Lsa" /v LimitBlankPasswordUse /t reg_dword /d 0 /f
echo 执行完毕,任意键退出
pause >nul
exit
Windows 10 远程桌面关闭
1、将下面的代码复制到新建文本文档中,将文本文档的后缀名修改为.bat格式,运行此文件即可关闭远程桌面;
@echo off
::获取管理员权限
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
cd /d "%~dp0"
::关闭远程桌面
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 1 /f
::启用防火墙
::netsh firewall set opmode mode=enable
netsh advfirewall set currentprofile state on
echo 执行完毕,任意键退出
pause >nul
exit
|