2

I wrote a script to remote execute test.cmd file by PsExec.exe.

PsExec.exe \\IP -u administrator -p password "C:\\Users\Administrator\Desktop\test.cmd"

Although I can run the script successfully, I cannot press any key to continue the process when it runs into command pause.

Press any key to continue . . . aaaaaa

The only way to keep going is press Enter.

Besides, if there are many lines of Pause or set /p which waits users to input, once user press Enter, it will affect couple lines of Pause or set /p. It really confuses me.

Huck Lin
  • 21
  • 3

1 Answers1

0

Best is that you use different logic in accordance with your limitations. Try exchanging the Pause with a different suitable solution.

Other suggestion would be that you share your code, inputs and expectations (output is already given - the script doesn’t continue). Then someone can review the code and suggest for further steps.

Alternatively, it is also possible that you can fix it by using Console.ReadKey()

Anton Todorov
  • 1,117
  • 1
  • 8
  • 14