bugZ
bugZ

Reputation: 494

Waiting for key press after Plink finishes executing remote command

I am using Plink to execute commands on remote computer. For example:

plink.exe -l login -pw password net stop spooler

Is it possible to do that after executing this command, Plink window will wait for my reaction (for example pressing button on keyboard)?

Upvotes: 1

Views: 1493

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202262

Run the Plink from a batch file (e.g. execute_command.bat) and add pause command:

@echo off
plink.exe -l login -pw password hostname net stop spooler
pause

Or you can do the same using cmd.exe, without using a separate batch file:

cmd.exe /C plink.exe -l login -pw password hostname net stop spooler & pause

Or you can use a server-side pause-like command on Plink command-line.

From your use of net stop, I assume the server is Windows, so again, you can use pause:

plink.exe -l login -pw password hostname "net stop spooler & pause"

Upvotes: 1

Related Questions