我有一个脚本,用psexec在远程计算机上调用记事本。有没有一种方法可以在启动后获得进程ID?启动后获取进程ID psexec
以下是我有:
$PCname = "MyPC"
$SessionID = "2"
$Program = "Notepad.exe"
$FilePath = "C:\temp\"
$FileName = "Test.txt"
set-alias psexec "C:\PsExec\psexec.exe"
&psexec -s -d -i $SessionID \\$PCname $Program $FilePath\$FileName
运行后我得到这个显示的进程ID的输出窗口:
Connecting to MyPC...Starting PSEXESVC service on MyPC...Connecting
with PsExec service on MyPC...Starting Notepad.exe on MyPC...
Notepad.exe started on MyPC with process ID 8352.
我怎么能抢进程ID?
我有点新手的。我如何从中获得我的进程ID? – Eric
它已经返回进程ID ;-) –
???我搞不清楚了。看不到它在哪里返回进程ID – Eric