使用浏览器在同网下远程执行cmd命令!(支持快捷指令)

想要单纯远程电脑的话可以用ssh powershell
ios快捷指令用着也非常方便

1.安装 OpenSSH
一般 Windows 会默认安装 OpenSSH,如果没有,管理员身份启动 PowerShell,执行以下操作可以查看:(系统设置>应用>可选功能---这里可安装)
Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
2.SSH 服务器的初始配置
管理员身份启动 PowerShell,执行以下指令:
# 先启动 sshd
Start-Service sshd
# 这条命令是可选,但是推荐的,可以让 sshd 自动启动:
Set-Service -Name sshd -StartupType 'Automatic'
3.为 OpenSSH 配置默认 shell(可选):
Windows 初始默认 Shell 是 cmd,Windows 还包括了 PowerShell 和 Bash。
先确保注册表中存在 Computer\HKEY_LOCAL_MACHINE\SOFTWARE\OpenSSH 这个路径。
然后可以在 PowerShell 中用以下命令将默认 shell 设为 PowerShell:
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
4.添加苹果快捷指令生成公钥文件(重命名id_rsa.pub)
#使用scp将生成的公钥文件复制到服务器上的administrators_authorized_keys文件
scp C:\Users\mesal\.ssh\id_rsa.pub C:\ProgramData\ssh\administrators_authorized_keys
#适当地ACL服务器上的authorized_keys文件
icacls.exe "C:\ProgramData\ssh\administrators_authorized_keys" /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F"