This is about sc.exe
I want to run my program as a service in Windows. I can do it using command prompt
My program is placed in system32 folder, so first I go to system32 and then I use these commands
c:\windows\system32>sc create demo binpath= "pg.exe" type= own start= auto DisplayName= "autostart"
c:\windows\system32>sc config demo binpath= "cmd.exe /c c:\windows\system32>pg.exe" type= own start= auto DisplayName= "autostart"
after executing these commands, when I restart my PC, my program starts running as a service which is fine.
Now, I want to make an autoit script which will execute these commands but unable to understand how I do it.
I tried this
#include <RunCMD.au3>
$cmd = "sc create demo1 binpath= c:\pg.exe type= own start= auto"
_RunCMD($cmd)
$cmd = "sc config demo1 binpath= "cmd.exe /c c:\pg.exe" type= own start= auto"
_RunCMD($cmd)
The first command executes successfully, but the 2nd command doesn't.

