windows - Why is my batch script running both if and else statement when if statement matches? -


the batch script processes else statement though if matches (and processed well). why this?

set getprocesslistlocal=wmic process name,processid echo type name of remote machine view processes of (or type local local machine), , press enter. set /p remotemachine= if %remotemachine%==local ( %getprocesslistlocal% ) else ( echo type user name access %remotemachine% with, press enter. set /p remoteuser= echo type password %remoteuser% on %remotemachine%, press enter. (will displayed in plaintext) set /p remotepassword= set getprocesslistremote=wmic /node %remotemachine% /user:%remoteuser% /password:%remotepass% process name,processid %getprocesslistremote% ) echo end of list. pause echo type process id , hit enter. set /p killid= if %remotemachine%==local ( wmic process processid="%killid%" call terminate ) else ( wmic /node %remotemachine% /user:%remoteuser% /password:%remotepass% process processid="%killid%" call terminate ) echo process id %killid% terminated. press enter exit. pause 

it may have trying echo: (will displayed in plaintext)

you can escape characters ^( , ^)


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -