because I need to execute a job that will clear a file after each user logs on ....so it must happen during script execution.
It is not the perfect load test environment ...so the clearing task is an effort to allow multiple users to log in with the same name...politics prevent creation of uniquie ids to test appropriately...
I had to try it, so I put "echo this works > this.txt" in file.bat and created an empty this.txt file.
This compiled and ran in QALoad 5.6 build 167 and VS2K5.
<font class="small">Code:</font><hr /><pre>HWND x; //Just need a handle struct to null per above help
ShellExecute(x, "open", "c:\\file.bat", "", "", SW_SHOWNORMAL);
The second parameter is supposed to be a verb such as from the right-click menu. But even though it flashed a cmd window, the text never showed up in this.txt as it did when I used right click and Open manually. But if you put "edit" for the verb, it leaves file.bat open in notepad.
There is a reference to IShellExecuteHook. I didn't find anything else in 5 minutes and don't have time to mess with the IShellExecuteHook right now...
All that said, there is probably a better way. Not sure what is in your bat file, but you should be able to find a way to get it to run continuously, clearing the file continuously, or something like that and just kill it manually (of course you can get much fancier yet, esp. with vbsript, etc.). This would be much cleaner to me and keep the junk out of QALoad...
If you find a way to get this to work, please post back how to do it!
A problem is a difference between what is perceived and what is desired, that
we want to reduce (Dewey 1933)