scott
Mon Jan 28 13:51:31 CST 2008
I finally got it to work using
c:\data\scripts\myscript.vbs /s:1
where s is my parameter.
For some reason, if I try to create the shortcut using the
%windir%\System32\wscript.exe //Nologo c:\data\scripts\myscript.vbs syntax
(even with no parameter), I get "Couldn't find script" error.
That's strange because I have some backup scripts with shortcuts like above
and they do fine.
"Tom Lavedas" <tglbatch@cox.net> wrote in message
news:5dc570e9-abf9-406f-9e88-b225c6cdc39c@n20g2000hsh.googlegroups.com...
> On Jan 28, 10:58 am, "scott" <sbai...@mileslumber.com> wrote:
>> I'm trying to find the proper syntax for creating a shortcut with
>> parameters
>> to my .vbs file. In SHORTCUT SYNTAX below, I listed how I've always
>> created
>> a shortcut on the desktop to launch my .vbs file. I listed my code below,
>> but I will be needing to pass 2 parameters for my real script.
>>
>> For my example below, what should the Target syntax be to pass a
>> parameter
>> to my .vbs file?
>>
>> SHORTCUT SYNTAX:
>>
>> To run from a shortcut, I create a new shortcut on the desktop with
>>
>> %windir%\System32\wscript.exe //Nologo c:\data\scripts\myscript.vbs as
>> the
>> Target and
>>
>> %windir% as Start In parameter.
>>
>> CODE:
>>
>> Set colArgs = WScript.Arguments
>> iState = LCase(colArgs(0))
>> Select Case iState
>> Case "Enable" blnState = True
>> Case "Disable" blnState = False
>> Case Else WScript.Echo "Please enter the script name followed by a " & _
>> "space and a parameter." & _
>> VbCrLf & "Valid names are: Enable and Disable." _
>> : WScript.Quit
>> End Select
>>
>> If blnState = True Then
>> MsgBox "Enable!"
>>
>> Else
>> MsgBox "Disable!"
>> End If
>
> If you are talking about creating a shortcut using the CreateShortcut
> method, all parameters are provided in the Argument property. The
> Target property must only have the pathspec for the application.
>
> However, the use of script to create the shortcut is not evident in
> what you posted, so I may be off-base. If you mean that you want to
> pass variable inputs to the shortcut, that can only be done in a
> static manner from a shortcut, that implies two different shortcuts
> (though for a toggle, I once wrote a script that altered the shortcut
> with each pass to provide the appropriate new input for the next
> pass). A long time ago in Win 9x it was possible, but NT did away
> with that capability.
>
> If you want variable input, the easiest way IMHO is to abandon the
> command line and just add an InputBox in the script.
>
> Tom Lavedas
> ===========
>
http://members.cox.net/tglbatch/wsh/