Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to create a process with a different name?

How to create a process with a different name?

Scheduled Pinned Locked Moved C / C++ / MFC
workspacetutorialquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chen Venkataraman
    wrote on last edited by
    #1

    I need to launch an executable multiple times passing in different argument list. Is there a way to use CreateProcess to launch the same executable but it shows in TaskManager as a different name? For e.g. ABC.exe gets launched as A1, A2 & A3. The reason for this is logging & configuration setup uses the process name & it would be easier to manage them with unique names instead of the executable name. Any pointers would be appreciated. TIA Chen Venkataraman

    D B 2 Replies Last reply
    0
    • C Chen Venkataraman

      I need to launch an executable multiple times passing in different argument list. Is there a way to use CreateProcess to launch the same executable but it shows in TaskManager as a different name? For e.g. ABC.exe gets launched as A1, A2 & A3. The reason for this is logging & configuration setup uses the process name & it would be easier to manage them with unique names instead of the executable name. Any pointers would be appreciated. TIA Chen Venkataraman

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Make copies of ABC.EXE, naming them ABC1.EXE, ABC2.EXE, and ABC3.EXE.

      1 Reply Last reply
      0
      • C Chen Venkataraman

        I need to launch an executable multiple times passing in different argument list. Is there a way to use CreateProcess to launch the same executable but it shows in TaskManager as a different name? For e.g. ABC.exe gets launched as A1, A2 & A3. The reason for this is logging & configuration setup uses the process name & it would be easier to manage them with unique names instead of the executable name. Any pointers would be appreciated. TIA Chen Venkataraman

        B Offline
        B Offline
        basementman
        wrote on last edited by
        #3

        You can pass a command-line parameter to the app via the CreateProcess call that it can use to set it's main window caption to. Task manager (and the launch bar) will use the main window caption for display.

        C 1 Reply Last reply
        0
        • B basementman

          You can pass a command-line parameter to the app via the CreateProcess call that it can use to set it's main window caption to. Task manager (and the launch bar) will use the main window caption for display.

          C Offline
          C Offline
          Chen Venkataraman
          wrote on last edited by
          #4

          Tried setting the title attribute of the STARTUPINFO structure but it didn't help. Task Manager still shows the executable as ABC.exe to continue with my example. But what i found is that if i specify both the lpApplicationName & lpCommandLine as follows, i can get a behavior close to what i want... lpApplicationName = ABC.exe [need the .exe even though the doc says it is optional] lpCommandLine = myABC arg1 arg2...etc Since argv[0] is interpreted as to mean the app name, by specifying a different name as the first token for the command line i could get the app to use this name instead of the executable name for picking up config & log stuff. I'm not sure if it is possible to get Task Manager to show a process with a different user-friendly name. Wondering how this is accomplished in the Unix world? [btw, this was an effort to simulate that behavior from the Unix side] Thanks for the response, anyway Chen Venkataraman

          D 1 Reply Last reply
          0
          • C Chen Venkataraman

            Tried setting the title attribute of the STARTUPINFO structure but it didn't help. Task Manager still shows the executable as ABC.exe to continue with my example. But what i found is that if i specify both the lpApplicationName & lpCommandLine as follows, i can get a behavior close to what i want... lpApplicationName = ABC.exe [need the .exe even though the doc says it is optional] lpCommandLine = myABC arg1 arg2...etc Since argv[0] is interpreted as to mean the app name, by specifying a different name as the first token for the command line i could get the app to use this name instead of the executable name for picking up config & log stuff. I'm not sure if it is possible to get Task Manager to show a process with a different user-friendly name. Wondering how this is accomplished in the Unix world? [btw, this was an effort to simulate that behavior from the Unix side] Thanks for the response, anyway Chen Venkataraman

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            It's NOT possible to change the name in Task Manager. You must have some capability in the app that your launching to change the window title from a command line parameter in order to do what you want. RageInTheMachine9532

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups