I am working on a batch script for my specific purpose.
The batch has launches a program like so:
[fixed]start /w program.exe %1[/fixed]
This way I can easily pass variable to my batch using a shortcut. Like:
[fixed]C:\mybatch.bat "My variable"[/fixed]
Because I the batch waits for the program to do its job, it could be open for extended periods of time. I find it annoying to have a batch constantly open, so looked for a way to hide it and settled on this short piece of VBS:
[fixed]CreateObject("Wscript.Shell").Run "mybatch.bat",0[/fixed]
This is is exactly what I needed and it makes things a lot easier, with one exception. While using this VBS, I can't pass variables to my batch... or to be more precise don't know how to.
My intention is to make several shortcuts with different variables like so:
[fixed]C:\start.vbs "My variable"[/fixed]
I want to be able to pass "My variable" to my batch, but still be able to manually launch start.vbs without any variable in a way that won't pass a random variable if it is not defined. Passing a blank variable is fine.
I have tried searching for a solution on Google, but being a total newbie to VBS, I couldn't find the right solution. Any help would be highly appreciated. Thanks in advance.
The batch has launches a program like so:
[fixed]start /w program.exe %1[/fixed]
This way I can easily pass variable to my batch using a shortcut. Like:
[fixed]C:\mybatch.bat "My variable"[/fixed]
Because I the batch waits for the program to do its job, it could be open for extended periods of time. I find it annoying to have a batch constantly open, so looked for a way to hide it and settled on this short piece of VBS:
[fixed]CreateObject("Wscript.Shell").Run "mybatch.bat",0[/fixed]
This is is exactly what I needed and it makes things a lot easier, with one exception. While using this VBS, I can't pass variables to my batch... or to be more precise don't know how to.
My intention is to make several shortcuts with different variables like so:
[fixed]C:\start.vbs "My variable"[/fixed]
I want to be able to pass "My variable" to my batch, but still be able to manually launch start.vbs without any variable in a way that won't pass a random variable if it is not defined. Passing a blank variable is fine.
I have tried searching for a solution on Google, but being a total newbie to VBS, I couldn't find the right solution. Any help would be highly appreciated. Thanks in advance.