PsExec run remote batch file in visible mode

☆樱花仙子☆ 提交于 2019-12-01 12:58:00

Alex K. is correct. Specifically, remove the "-d", which tells PsExec "Don't wait for process to terminate (non-interactive)". In fact, if you run the sample batch file above, which includes "pause", the cmd process will continue to run on the remote host (invisible to the remote host's GUI, since it's done via PSExec) until you kill that process.

Dipti Chaudhry

I think you can look at the Session Id for your current user and pass it as parameter with -i For example:

PsExec.exe -s -d -i 2 c:\temp\MyServer MyConsoleApp.exe

To look at the current Session Id you can run query session

Sometimes the Session Id is 2 for the active user you want to start process for, so try looking for your correct Session Id and use it with -i parameter.

Venkat Keesara

Try one of those:

  1. psexec \\server -u xxx-p xxxx /accepteula  -i 1 -d cmd.exe /K "cd d:\test && call hello.bat"
    
  2. psexec \\server -u xxx -p xxxx /accepteula  -i 1 -d d:\test\hello.bat
    
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!