Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7667957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:14:07+00:00 2026-05-31T15:14:07+00:00

I’m attempting to launch a process from a different process. The mechanism in which

  • 0

I’m attempting to launch a process from a different process. The mechanism in which this is achieved is not subject to change. Both the launcher and the original process are located in C:\dir.

I’m starting my launcher from a cmd file. The cmd file itself is located somewhere else, and in order for it to find the launcher executable, I’m setting the PATH variable:

set PATH=C:\dir;%PATH%;
launcher.exe

The launcher starts the child process with the following code:

  STARTUPINFO startupInfo;
  startupInfo.cb               = sizeof (STARTUPINFO);
  startupInfo.lpReserved       = 0;
  startupInfo.lpDesktop        = NULL;
  startupInfo.lpTitle          = NULL;
  startupInfo.dwX              = 0;
  startupInfo.dwY              = 0;
  startupInfo.dwXSize          = 0;
  startupInfo.dwYSize          = 0;
  startupInfo.dwXCountChars    = 0;
  startupInfo.dwYCountChars    = 0;
  startupInfo.dwFillAttribute  = 0;
  startupInfo.dwFlags          = _showInForeground ? STARTF_USESHOWWINDOW : 0;
  startupInfo.wShowWindow      = _showInForeground ? 1 : 0;
  startupInfo.cbReserved2      = 0;
  startupInfo.lpReserved2      = 0;

  PROCESS_INFORMATION processInfo;

  BOOL retVal = CreateProcess("child.exe", "", NULL, NULL, FALSE, 
                    _showInForeground ? (CREATE_NEW_CONSOLE | CREATE_DEFAULT_ERROR_MODE) : CREATE_DEFAULT_ERROR_MODE,
                    NULL, NULL, &startupInfo,&processInfo);

It returns 0 and last error is 2, which is File not found.

If it helps, GetCurrentDirectory returns the directory where the cmd is located, not C:\dir. I’m guessing CreateProcess can’t find child.exe because PATH is not available to it.

Any ideas how to get this to work?

EDIT: Some good comments with answers (as comments are sometimes overlooked):

Suggestion: set statupInfo.lpDirectory to “c:\dir”

Answer: can’t. I’m starting from the cmd because the directory may change.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T15:14:08+00:00Added an answer on May 31, 2026 at 3:14 pm

    According to MSDN, CreateProcess actually does search PATH, but only if lpApplicationName is NULL and the executable is the first token in lpCommandLine.
    In other words it should work if you call CreateProcess(NULL, "child.exe", ...

    I haven’t tried it though, so YMMV and so on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.