testcomplete command execution

92 Views Asked by At

I am running the below code in the testcomplete . It opens a command line and executes the command mentioned in the command line. However after the execution of the command , the control is not returned back to the testcomplete. what seems to be the issue here?

WshShell.Run("cmd /K cd C:\Users\Tester\ & echo testing",1,true); Log.Message("completed");

1

There are 1 best solutions below

0
primehunter On

The 'issue' seems to be the '/K' in your command line: This means, cmd keeps open after running the commands. (I.e. WshShell is waiting for cmd to complete for ever.) Try '/C' instead: this means, cmd run the commands and ends after that. I.e:

WshShell.Run("cmd /C cd C:\Users\Tester\ & echo testing",1,true); Log.Message("completed");

You get more input on the /C and /K options calling following command from the prompt:

cmd /?

(Do WindowsKey+R, type cmd.exe and then enter to get the prompt.)

I hope this help.