Using Jenkins, we have setup automation testing - install application and run test cases in a remote machine. This process is done using a batch file. As it is a windows application I have to logout (remote machine) of the system keeping the session active. For that I have used the below script:
for /F "skip=1 tokens=3" %%s in ('query user testuser') do
(C:\Windows\system32\tscon.exe %%s /dest:console )
In remote machine, when I run this script manually, it works perfectly. But when the same script (batch file) is run from Jenkins I am getting following error:
'query' is not recognized as an internal or external command, operable program or batch file.