使用瀏覽器在同網(wǎng)下遠程執(zhí)行cmd命令?。ㄖС挚旖葜噶睿?/h1>

想要單純遠程電腦的話可以用ssh powershell
ios快捷指令用著也非常方便

1.安裝 OpenSSH
一般 Windows 會默認安裝 OpenSSH,如果沒有,管理員身份啟動 PowerShell,執(zhí)行以下操作可以查看:(系統(tǒng)設(shè)置>應(yīng)用>可選功能---這里可安裝)
Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
2.SSH 服務(wù)器的初始配置
管理員身份啟動 PowerShell,執(zhí)行以下指令:
# 先啟動 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 設(shè)為 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將生成的公鑰文件復(fù)制到服務(wù)器上的administrators_authorized_keys文件
scp C:\Users\mesal\.ssh\id_rsa.pub C:\ProgramData\ssh\administrators_authorized_keys
#適當?shù)谹CL服務(wù)器上的authorized_keys文件
icacls.exe "C:\ProgramData\ssh\administrators_authorized_keys" /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F"