Ask a Question

Running a batch file via Tested apps not working as expected

Occasional Contributor

Running a batch file via Tested apps not working as expected



I am running a batch file that should disconnect me from the Virtual machine, however, when i run the batch file via tested apps i get a syntax error in the batch file.


The content is


for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (
  %windir%\System32\tscon.exe %%s /dest:console


The error is 'query' is not a recognized as an internal or external command, operable program or batch file.


When I run the batch file manually it works as intended. Also Testcomplete is running in administrator mode.


Any ideas?


Esteemed Contributor

How do you have the batch file being called in TestComplete?  My suggestion would be to run it using CMD.EXE /c to actually shell out to execute the batch if you're not already doing so.

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Super Contributor

try like this- 


Set shell = CreateObject("WScript.Shell")
shell.Run "cmd /k myBatch.bat", 1, True

Showing results for 
Search instead for 
Did you mean: