Running msched scripts using CreateProcess API call

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
ctower
Newbie
Posts: 3
Joined: Tue May 27, 2003 10:23 pm
Location: Calgary, Alberta

Running msched scripts using CreateProcess API call

Post by ctower » Tue May 27, 2003 10:44 pm

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

Lumumba

Post by Lumumba » Wed May 28, 2003 3:46 pm

//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

ctower
Newbie
Posts: 3
Joined: Tue May 27, 2003 10:23 pm
Location: Calgary, Alberta

Post by ctower » Wed May 28, 2003 5:31 pm

I'm sorry I wasn't clear enough. I'm calling CreateProcess from within a VB6 project not within the msched script. Although, I'm pretty sure the msched documentation says to exclude the spaces around '=' when using command line variables.

ctower
Newbie
Posts: 3
Joined: Tue May 27, 2003 10:23 pm
Location: Calgary, Alberta

Work Around found

Post by ctower » Wed May 28, 2003 8:06 pm

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.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts