Re: how to Open notepad with a command-line argument



Daz schrieb:
I would like to keep this as simple as i can and so if I can work with
the format below it would be very helpful. I am very new to VBscript
and am finding my way as i go.

If WScript.Arguments.Named.Exists( "e" ) Then
CreateObject( "WScript.Shell" ).Run "notepad"
Else
WScript.Echo "no no"
End If

Cheers!

As the options you want to work with

<yourscript>.vbs /c:"something else here" /u:"a reference here"

aren't simple boolean (yes/no) switches like in

<yourscript>.vbs /e

you can't just check whether the user entered an option name (e.g. /c) but
you have to read/store/work with the option value (e.g. "something else here").

.



Relevant Pages

  • Re: how to Open notepad with a command-line argument
    ... the format below it would be very helpful. ... I am very new to VBscript ... MsgBox "Switch 'C' used" ... MsgBox "No switches specified!" ...
    (microsoft.public.scripting.vbscript)
  • Re: date field as sql table key
    ... >>> Using VBscript. ... I would like to use a date field with the format ... Private Declare Sub GetLocalTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) ... Public Function GetTimeAsString() As String ...
    (microsoft.public.vb.general.discussion)
  • RE: Preformatted Files
    ... it is possible to direct Word from VBScript just like any other COM ... Word macro from internal to external commands. ... to a word file in a format that is predefined. ... output it into a word file in that format and then save the file. ...
    (microsoft.public.scripting.vbscript)
  • RE: Preformatted Files
    ... it is possible to direct Word from VBScript just like any other COM ... Word macro from internal to external commands. ... to a word file in a format that is predefined. ... output it into a word file in that format and then save the file. ...
    (microsoft.public.scripting.vbscript)
  • Re: Win XP SP3 database access
    ... Another vbScript is used to retrieve this information and write it to a text file. ... Since Windows XP Service Pack 3 was applied users of this script now have the date written in American Format. ... PC's without SP3 don't. ... settings". ...
    (microsoft.public.scripting.vbscript)

Loading