Ask a Question

powershell equivalent of running testexecute with command line arguments

Regular Contributor

powershell equivalent of running testexecute with command line arguments

in the SmartBear support documentation is this site


that shows how to run testcomplete/testexecute using the command line. at the very bottom on the page is this:


If you want the command line to wait until the test (project and so on) execution is over, you can use the START command as shown in the example below:

start "My Title" /wait TestComplete.exe "C:\Work\My Projects\MySuite.pjs" /run /exit /SilentMode



Pay attention to the string after the START command in the example above. It is the title of the command-line window and it is needed for the command to work correctly.


My question is, if I'm using powershell instead of a CMD window, would this line of powershell:


Start-Process -FilePath "C:\Program Files (x86)\SmartBear\TestExecute 15\x64\Bin\TestExecute.exe" -ArgumentList "C:\Work\My Projects\MySuite.pjs" -Wait


be the equivalent of the CMD example shown above from the smartbear support site? if not, then what would the powershell equivalent of it be? i'm curious about not including the /run, the /exit and the /SilentMode arguments and not giving it a title. 


since powershell appears to be the more accepted utility these days, shouldn't smartbear update their support site to give powershell examples instead of (or at least in addition to) command line arguments? just curious. 

Regular Contributor

i have also tried a bat file. again, when i run it manually it works perfectly. when it is called from task scheduler it doesn't work. i will give your bypass suggestion a try and let you know if that helps any. 

Champion Level 2

Oops, sorry about that @dhundley Correct command is,


Start-Process 'C:\Program Files (x86)\SmartBear\TestExecute 15\x64\Bin\TestExecute.exe' -ArgumentList """C:\Sandbox\TestComplete\Proj\Proj.pjs"" /run /exit /DoNotShowLog /ExportLog:""C:\Sandbox\Log\index.html""" -Wait


On the VM, create a file called e.g. AutomateTC.ps1 with the above command. Create a task schedule and the program/script to run is C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe (location of your powershell.exe) followed by arguments -WindowStyle Minimized -File C:\Sandbox\AutomateTC.ps1 (window style minimized is optional; location of your .ps1 script) and start in %HOMEDRIVE%%HOMEPATH% (optional)


While on the VM, if you right click the scheduled task you've added, select Run, it will run TC.


The above will work, providing the user is logged on to the VM and the session is active. You will most likely want to run the scheduled task without having to be logged on to the VM, therefore, you'll need to use SessionCreator.

Regular Contributor

i have another ps1 file on the same VM that is also run as a scheduled task and it works just fine.  all I have in its program/script box for the Action in Task Scheduler is "powershell.exe" (not the entire path). rather than containing a start-process statement, all that ps1 file has in it is a Send-MailMessage, the Arguments box has the -file switch and the fully qualified pathname and file of the ps1 file and does not have a -Verb RunAs argument.  Rather than having a scheduled start time it is triggered when the computer starts. As I said, it runs perfectly


for this scheduled task the ps1 file has the start-process statement for running testexecute and I have coded it just as your recommended. i think i already mentioned that if i manually run the powershell from the ISE it completes successfully. TestExecute starts up, runs the project/unit/script and then closes. For some reason though it is not working when the task scheduler job tries to run it and I am logged on and watching it. it doesn't even fire up TestExecute. I've tried putting the -Verb RunAs on the start-process line and that doesn't help either. I've also tried bypassing the execution policy but that didn't work. 


Clearly this is not an issue with TestExecute nor is there a problem with how I have written the powershell script (since it works when i run it manually) but rather there is something wonky about Task Scheduler or possibly about the VM itself. I will continue to work on it and if i ever get it running i will come back here and post the solution. Thanks for all your help. 

Champion Level 2

Launch PowerShell command prompt and type in 'testexecute'. If you get an error, then you'll need to set your environment path variable e.g. $env:Path += ';C:\Program Files (x86)\SmartBear\TestExecute 15\x64\Bin;' (include this in your .ps1 file). Type in 'testexecute' again, and it should launch.



Exit TestExecute, now try your Schedule Task again.


FYI, the instructions I've given, are the ones that I use on my VM.

Regular Contributor

if i bring up the powershell command prompt and type in TestExecute it launches TestExecute. i get an error popup about it not specifying a valid project suite or project but powershell knows about testexecute. remember, if i run the powershell script manually (with the start-process statement that you provided) it does work. the problem is getting Task Scheduler to run it. also, as i've already said before. i have another scheduled task that is triggered at system start up which also runs powershell to send an email and that works also. so task scheduler know how to run powershell. i just can't figure out why task scheduler is having an issue with the start-process cmdlet in powershell. 


i really appreciate your effort but i feel like we keep going over ground that has been covered before instead of trying something new. as i said, i'll keep after it and post the resolution when/if i ever come up with something. i'm guessing it's something weird with the VM and i'm asking our support help desk guy who set the VM up for me if he's got any ideas. thanks again!

Champion Level 2

The properties for my task schedule looks like,


Username shown, has full admin access.


I've shown you the commands that I use






History showing completed task schedules



Try to schedule a task for .ps1 script that contains only,


Write-Output 'Testing schedule task'


And if that doesn't work, then does the History tab show anything?


Regular Contributor

i think i have figured out why it wasn't working and your first screen shot above actually confirms it. what i did was to simply create a powershell script that points to notepad.exe in the start-process and to a file name  for it to open in the -argument list. again, it ran fine when i manually ran it in powershell but would not run and open the file in notepad when i used task scheduler. i found this stackoverflow article

which made the point that

The application was ran in background. To make it run on foreground, had to check the box Run only when user is logged on.

so i changed the General tab from Run whether use is logged on or not to Run only when user is logged on and then the Scheduled Task worked and the file came up on notepad. i'm going to apply this to the testexecute scheduled task now and i'll report back if it is successful.  





Champion Level 2

If I remember correctly "background" will run the application, but there won't be any visible UI. Ideally, it's used for windows services.


Now that you know the mistake you made, TC should work fine - fingers crossed!

Regular Contributor

ok. that worked. i set the task to start at a specific time then I disconnected (while keeping the RDP session up and active for testexecute) and once I reconnected several minutes later I could tell that test execute had started, ran the script and closed perfectly. i guess i got confused by the fact that my other scheduled task (which is triggered by the VM getting restarted) didn't need to "run only when user is logged in" to be successful. 


thanks again for all your help

Showing results for 
Search instead for 
Did you mean: