I am trying to call an executable at startup, which will call another executable itself. For the first part, I simply added the path to the executable to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
, which works, my executable is called at startup.
The latter contains, among others, these lines :
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = subprocess.SW_HIDE
proc = subprocess.Popen(command, startupinfo=startupinfo)
However, a command shell (cmd) pops when the computer starts. Everything works fine, but it is visible instead of hidden... So basically, how do I hide this command shell ?
When using ProcessExplorer
, I have the following hierarchy :
+ System
|_ Interrupts
|_ smss.exe
|_ some processes...
+ explorer.exe
|_ some processes...
|_ MYSCRIPT.EXE
Here is the sequence I try to achieve :
- I create an ISO file containing all the Python executable I want to run on the VM. One of them (
master.exe
) calls the others. - I create a VM which automatically mount the latter
- The VM, which was prepared, has a scheduled task which calls
D:\master.exe
master.exe
(among other tasks which are not our concern here) adds the valueD:\myscript.exe
toHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
- The VM reboots
D:\myscript.exe
is run (and it works fine and as attended), but it does run in a command prompt, which I would like to be invisible.