Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ExecuteAndWait problem
Message
From
05/12/2001 12:06:16
 
 
To
05/12/2001 11:36:47
General information
Forum:
Visual Basic
Category:
Windows API functions
Miscellaneous
Thread ID:
00589912
Message ID:
00589952
Views:
32
>Hello everybody,
>Here is the code of ExecuteAndWait
>Public Sub ExecuteAndWait(cmdline$)
> Dim NameOfProc As PROCESS_INFORMATION
> Dim NameStart As STARTUPINFO
> Dim X As Long
>
> NameStart.cb = Len(NameStart)
> X = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS,
> 0&, 0&, NameStart, NameOfProc)
> X = WaitForSingleObject(NameOfProc.hProcess, INFINITE)
> X = CloseHandle(NameOfProc.hProcess)
>End Sub
>This function works correctly. The problem appears when the command line you pass to this function contains gaps,
>then this function doesn't function at all. examples of the command line you pass that doesn't work:
>C:\WINNT\system32\UNIX2DOS.EXE C:\Documents and Settings\Elharissa Robert\Desktop\samples\cmt.rte
>the problem is the gaps in Document and setting.
>Can any body point me in the right direction?

In the string passed in STARTUPINFO, encapsulate arguments containing embedded spaces in double quotes, to let the VDM CLI parser know to treat the string as an argument as a whole, eg:
C:\WINNT\system32\UNIX2DOS.EXE "C:\Documents and Settings\Elharissa Robert\Desktop\samples\cmt.rte"
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform