1

I have a program which I install using an NSIS script. The final step in the installer is to write to the registry Run key and have the program run on startup. I've confirmed that under

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run 

exists the key

MyCompany Program - C:\MyCompany\Program\launch.vbs

I've tried the key with and without quotes but there was no impact. I have confirmed the registry is reading from CurrentVersion\Run by adding

Notepad - C:\windows\notepad.exe

and Notepad now launches at startup. The launch.vbs script is a one liner to launch a script without the cmd.exe window:

'HideBat.vbs from https://superuser.com/questions/140047/how-to-run-a-batch-file-without-launching-a-command-window
CreateObject("Wscript.Shell").Run "cmd /c " & chr(34) & "C:\MyCompany\Program\run.cmd " & chr(34), 0, True

I've confirmed calling launch.vbs from an explorer window or from cmd.exe works as I expect (launching my program). msconfig confirms that C:\MyCompany\Program\launch.vbs is listed in the startup tab. The security tab of File Properties indicates all users should have read & execute privileges. Ditto the run.cmd actually getting called.

At this point I'm at a loss as to why my program isn't being launched, and I can't figure an efficient way to debug it.

System is Windows 7 Professional 64-bit.

guest
  • 21

1 Answers1

1

With the help of LPChip, I started messagebox debugging and confirmed the script was being launched, but erroring out. I updated the launch.vbs to

CreateObject("Wscript.Shell").Run "cmd /k " & chr(34) & "C:\MyCompany\Program\run.cmd " & chr(34), 1, True

(note the /k to keep the window alive, and 1 to show). From there, it was apparent that java isn't set on the classpath for scripts launched via CurrentVersion\Run. Hard-coding the path to java (which our clients will be forced to use anyways) in run.cmd solved the issue.

guest
  • 21