Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 如何通过.bat文件在远程计算机上运行程序_Batch File - Fatal编程技术网

Batch file 如何通过.bat文件在远程计算机上运行程序

Batch file 如何通过.bat文件在远程计算机上运行程序,batch-file,Batch File,我想从另一台计算机在远程计算机上运行文件。我正在使用这个代码 set executeAs=%user% set executeAsPwd=%userPwd% schtasks /Create /S %machine% /U %user% /P %userPwd% /RU %executeAs% /RP %executeAsPwd% /SC ONCE /TN install /TR %file% /ST 10:11:00 schtasks /Run /S %machine% /U %user% /

我想从另一台计算机在远程计算机上运行文件。我正在使用这个代码

set executeAs=%user%
set executeAsPwd=%userPwd%
schtasks /Create /S %machine% /U %user% /P %userPwd% /RU %executeAs% /RP %executeAsPwd% /SC ONCE /TN install /TR %file% /ST 10:11:00
schtasks /Run /S %machine% /U %user% /P %userPwd% /TN install
pause

但它显示错误访问被拒绝

您的代码被混淆了。我们不能检查任何有关它的情况。这是在远程计算机上运行程序的更直接的方法

要生成已打开的计算机列表,(在批处理文件中,交互键入时使用
%%a
而不是
%a

要运行程序,请使用(注意:远程程序在远程计算机上不可见,因为您不能干扰用户)。请注意,命令行使用了双反斜杠

wmic /node:@"%userprofile%\desktop\computername.txt" /failfast:on process call create "c:\\windows\\notepad.exe"
请参见
wmic/?
wmic进程/?
wmic进程获取/?
wmic进程集/?
wmic进程调用/?
wmic/format/?
wmic/node/?
,以及
wmic/failfast/?
。另外还有
for/?
网络帮助视图
网络视图/?
是简短的帮助)和
findstr/?


要了解标点符号的含义,请参见

请格式化此文件,使代码可读!我该如何格式化这个代码呢?因为它在我的电脑上看起来还可以看一看psexec:请根据我的代码帮助我你好,有人能帮我吗
wmic /node:@"%userprofile%\desktop\computername.txt" /failfast:on process call create "c:\\windows\\notepad.exe"