Hello,
I need to execute a batch file (.bat) remotely. The bat file is used to start a jar file. I've tried several scripts:
invoke-command -scriptblock {start-process xxx.bat} -computername RemoteComputer
invoke-command -scriptblock {cmd.exe /c xxx.bat} -computername RemoteComputer
invoke-command -scriptblock {& "xxx.bat"} -computername RemoteComputer
The first script works well, and .jar is started by batch file. However, java.exe runs in background and I can't see any output when I use Remote Desktop to remote computer. More seriously, the jar file will call webdriver and run Chrome.exe, but the chrome.exe also runs in background and some bugs then occur. How can I run batch file or jar file remotely not in background?
The second and third command will be stuck because jar file consistently output results in prompt. Also these command start java.exe in background.
How can I execute files just like double clicking them?
Thanks in advance