0

I'm trying to put a .bat file in my startup folder so it will run code when my computer starts up, but I don't want to see it. The batch file runs an .exe file with arguments. I was using this code in a .vbs script.

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "C:\Test\My.bat" & Chr(34), 0
Set WshShell = Nothing

When I run it, it calls the .bat file and the bat file doesn't run the .exe with the parameters. Why is this? When I run just the .bat file, it calls the .exe just fine. I would appreciate it if someone could tell me how I could edit the code to make it work.

Hennes
  • 65,804
  • 7
  • 115
  • 169
ddos
  • 1
  • 1

2 Answers2

0

Check out the use of the START command as illustrated in this question. The first answer in that question has more details, but here is the simple answer:

start /b "" "c:\Path\To\Your\Program.exe" -arguments
-1

You do not need to use a VBScript application. You can directly call the executable file. Just create a shortcut of the executable file and place it into the startup folder, then set its arguments from shortcut properties` target section. Make sure to choose minimized window position because "you don't want to see it". A sample setting that is:

enter image description here

STEEL
  • 39