start without inheritance of parents file descript

2019-07-11 06:44发布

I need to start some process on winXP with "start" command. Sounds simple.

But is there a way that the started process would not inherit any ports from parent?

I start children in my program using:

system "start x -params"

Now when parent is being killed, I can't start it again because I'm learned by errors that some process is already occupying port (which killed parent was using).

I don't want to use:

  • createProcess (from winAPI, where this can be setup to not inherit fds)
  • use python in my start string (or any similar interpreters)

Is there a way to start my child process in a way I want them to start?

Is there any "start" alternative?

2条回答
混吃等死
2楼-- · 2019-07-11 07:10
powershell -command "Start-Process myprogram.exe"
查看更多
老娘就宠你
3楼-- · 2019-07-11 07:12

So after diggin a while, i've found:

psexec

with commandline like:

psexec -d -s myprogram > logfile.log 2>&1

everything is solved.

查看更多
登录 后发表回答