0

I am trying to run a program from cmd, but not as a child of the prompt. I have tried calling the program directly: program, but this starts it as a child process. I have tried start "" program, but this also starts it as a child process. Is this possible? I don't want the program to close when the prompt is closed.

Edit: This is not a duplicate question - start doesn't work in this case. I don't know enough to explain better, but some things to note:

  • The program in question doesn't open a new window
  • The path to the program contains spaces, so requires inverted commas. However, the inverted commas seem to suggest to start that the argument is intended to be the name of the new command window.
  • I need to pass switches to the program, which makes things a bit more complicated
Dimpl
  • 935
  • 1
  • 10
  • 24
  • `start` should do it; what program? – aschipfl Jun 09 '18 at 12:30
  • http://www.snakebytestudios.com/projects/apps/cursor-lock/ – Dimpl Jun 10 '18 at 12:49
  • If I doubleclick the shortcut the program creates, I get the desired behaviour. However, I want to be able to do this from the command prompt. – Dimpl Jun 10 '18 at 12:57
  • The command I would expect to work is `start "" "C:\Program Files (x86)\Cursor Lock\CursorLock.exe" /I /M:1` but this launches the program as a child to the prompt. – Dimpl Jun 10 '18 at 12:59
  • If you check out the target of the shortcut you mentioned, you have got the command line to use... – aschipfl Jun 10 '18 at 15:35
  • That's what you'd think. The target of the shortcut is "C:\Program Files (x86)\Cursor Lock\CursorLock.exe" /I /M:1, and everything I've tried launches a child process. – Dimpl Jun 11 '18 at 05:31
  • I've tried launching the shortcut from the prompt as well. Again, creates a child process. – Dimpl Jun 11 '18 at 05:33
  • What specifically is the problem of it being a child process? This sounds like an X/Y problem. To be specific, if process A in Windows starts process B, A will be a parent of B and B will be a child of A. You cannot change that. What exactly is it that you want to happen? Or, what is happening that you don't want? – Lasse V. Karlsen Jun 12 '18 at 11:11
  • Additionally, this sounds like a [su] question, unless the problem really is that you're trying to start the second program from within your own program, and not from cmd. – Lasse V. Karlsen Jun 12 '18 at 11:12
  • The issue is that I want the program to persist after the calling command prompt closes. I’m not sure if the question belonged here or on super user, I thought super user was more appropriate but saw similar questions posted here. – Dimpl Jun 13 '18 at 13:43
  • To give a counterexample, consider `start notepad.exe`. The notepad process does not appear as a child process in the task manager, and is not closed when the command prompt exits. – Dimpl Jun 13 '18 at 13:46
  • I think I've worked it out - the particular program I am using defaults to closing when the calling window is closed. – Dimpl Jun 13 '18 at 13:53

0 Answers0