Re: CreateProcess not working as doc specifies.



In message <5EAB7DEB-B0F9-47D3-8CA7-D64844A1218C@xxxxxxxxxxxxx> of Mon, 13 Jun 2005 13:50:17 in microsoft.public.win32.programmer.kernel, David Bennion <David@Bennion.?.microsoft.com.invalid> writes
I am having some difficulty using CreateProcess() to run a batch file and get
the same return code as I get from the command shell.  I am trying to run the
batch in the manner suggested by the CreateProcess documentation, but it
fails to run.
URL? or quotation.


I am posting all of the background information below (sorry if the wordwrap from the post obfuscates anything):

Snippet of doc from CreateProcess() msdn doc:
--------------------------------------------------------
"To run a batch file, you must start the command interpreter; set
lpApplicationName to cmd.exe and set lpCommandLine to the name of the batch
file."

[snipped code]

Tried your code in Visual C++ 6.0 SP 5 on Windows 2000 Professional SP4.
I snip my results:
// OK if(CreateProcess("C:\\winnt\\system32\\cmd.exe", "/C C:\\DOCUME~1\\ADMINI~1.BRI\\LOCALS~1\\Temp\\david\\t.bat",
// US if(CreateProcess("cmd.exe", "/C C:\\DOCUME~1\\ADMINI~1.BRI\\LOCALS~1\\Temp\\david\\t.bat",
// OK if(CreateProcess("C:\\winnt\\system32\\cmd.exe", "/C t.bat",
// US if(CreateProcess("C:\\winnt\\system32\\cmd.exe", "t.bat",
// OK if(CreateProcess(0, "t.bat",

MSDN says about lpApplicationName: "will not use the search path".
Does this meet your need?
--
Walter Briscoe
.



Relevant Pages

  • command shell looping
    ... when i try to run a batch file e.g. myfile.bat on the machine the command shell will open but execution will just loop with no actual command being carried out by the batch. ...
    (microsoft.public.windows.server.scripting)
  • Re: Multi-zip files -- Windows server
    ... native DOS versions). ... TO BATCH OR NOT TO BATCH ... and using a batch file to try and solve the problem... ... The IBM PC operating system command line is a most ...
    (comp.sys.cbm)
  • Re: EWF RAM
    ... Do you mean it is running the stress test fine locally on the device? ... If it does and the issue has no repro, you should move to use local batch file approach in your support scenario. ... >> A tech plugs into it with laptop and remote desktops to it. ...
    (microsoft.public.windowsxp.embedded)
  • Re: Windows "Scheduled Task Wizard..."
    ... Do you know any links at Microsoft documents related to the batch file ... command name to get started. ... VB Script and any other Microsoft scripting languages have nice ...
    (microsoft.public.windows.server.general)
  • Re: why cant i get variable value?
    ... i call this bath file in another batch file. ... batch executes the statement using the value AT PARSE TIME. ... @ECHO OFF ...
    (microsoft.public.win2000.cmdprompt.admin)