如何执行命令

2024-09-28 16:53:59 发布

您现在位置:Python中文网/ 问答频道 /正文

我必须使用plink来执行cmd,在远程桌面上使用7z.exe解压文件

C:\windows\system32>C:/E2EPerformance/tool/PROD/STCP/BreadcrumbCollector/binary/plink.exe -ssh -l admin -pw pass IP cmd.exe /c cd 7z.exe x D:/PostProcess/Processed/20150417_01.zip -oD:/PostProcess/Processed/temp

是程序错误:

The filename, directory name, or volume label syntax is incorrect.

以及

C:\windows\system32>C:/E2EPerformance/tool/PROD/STCP/BreadcrumbCollector/binary/ plink.exe -ssh -l admin -pw pass IP cmd.exe /c 7z.exe x D:/P ostProcess/Processed/20150417_01.zip -oD:/PostProcess/Processed/temp

我得到了:访问被拒绝了。但我访问了远程桌面

^{4磅}$

我得到:参数格式不正确-“后处理”。在


Tags: cmdwindowsprodtoolexesshbinaryplink
1条回答
网友
1楼 · 发布于 2024-09-28 16:53:59

Windows对路径使用反斜杠。开关的正斜杠(尽管命令网可在正斜杠和短划线之间切换)。它用引号将路径和参数括起来。虽然我们有各种方法来查找文件,但唯一确定的方法是指定完整路径。在

如果你是管理员,只需把文件放在另一台电脑上。使用\\server\share\path。在

copy "c:\MyHardDrive\somefile.ext" \\RemoteComputerName\C$\RemoteHardDrive\Somefile.ext

wmic也可以远程执行。注意反斜杠被转义。在

^{pr2}$

或者

wmic /node:127.0.0.1 process call create "c:\\PathToRemote7Zip\\7Zip.exe C:\\RemoteHardDrive\\Somefile.zip C:\\RemoteHardDrive\\Somefile.ext

WMIC也有用户和密码开关。在

相关问题 更多 >