Does anyone have any experience executing msched scripts using kernel32 function CreateProcess? I've had some success when calling with LPCTSTR = NULL and putting the entire app call and cmd line in LPTSTR, but then I have to make sure that there are no spaces in any of the variable switches (1).
When I call CreateProcess with the msched exe in LPCTSTR and the Script name and variable switches in LPTSTR, msched says it can't find a script of that name(2).
I wont post the whole ugly code but the jist is...
1) Works, but I want spaces not underscores
LPCTSTR = NULL
LPTSTR = "C:\Progra~1\MJTNet~1\MacroS~1\msched.exe" My Script /filename=Q1_cnrpldls.csv /path=U:\data\ /rg=Q2_2003_QBLM_PL /feature=Q2_2003_QBLM_PL /inspect=Q2_2003
2) Doesn't recognize Script Name
LPCTSTR = C:\Progra~1\MJTNet~1\MacroS~1\msched.exe
LPTSTR = My Script /filename=Q1_cnrpldls.csv /path=U:\data\ /rg=Q2_2003_QBLM_PL /feature=Q2 2003 QBLM PL /inspect=Q2_2003
FYI on CreateProcess:
http://msdn.microsoft.com/library/defau ... rocess.asp
Running msched scripts using CreateProcess API call
Moderators: JRL, Dorian (MJT support)
//there has to be a "space" (ASCII 32) after the "=" sign!
Code: Select all
Let>space=
LPTSTR = My Script /filename=Q1%space%cnrpldls.csv%space%/path=U:\data\%space%/rg=Q2%space%2003%space%QBLM%space%PL%space%/feature=Q2%space%2003%space%QBLM%space%PL%space%/inspect=Q2%space%2003
Work Around found
Well, I got it to work if I strictly used the CommandLine argument for CreateProcess and put embedded quotes around every element. The string looks like this:
"C:\Progra~1\MJTNet~1\MacroS~1\msched.exe" "My Script" "/filename=Q1_cnrpldls.csv" "/path=U:\data\" "/rg=Q2_2003_QBLM_PL" "/feature=Q2 2003 QBLM PL" "/inspect=Q2_2003"
Now, the spaces come through to the script for the 'feature' variable.
"C:\Progra~1\MJTNet~1\MacroS~1\msched.exe" "My Script" "/filename=Q1_cnrpldls.csv" "/path=U:\data\" "/rg=Q2_2003_QBLM_PL" "/feature=Q2 2003 QBLM PL" "/inspect=Q2_2003"
Now, the spaces come through to the script for the 'feature' variable.