
Problems using WScript to execute a batch file
Take a look at this old post (attached)
Running it or with a batch file from there should be easy.
--
mvp Mark L. Ferguson Please reply in newsgroup
marfers notes for OE 5 > (16K)
http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm
Quote:
> Mark,
> I also need to try to get a batch file or even the actual
program run
> from a script. Would prefer to have the program executed from the
script.
> Problem that I have encountered is not being able to pass the
arguments that
> the program needs to it. Can you show me a way of doing this.
> Jon
> ...
> Obj.Run '%comspec% /c c:\mybat.bat'
[ Attached Message ]
From: |
|
To: |
|
Date: |
Mon, 26 Jul 1999 20:01:18 -0400 |
Local: |
Mon, Jul 26 1999 8:01 pm
|
Subject: |
Re: How do you pass script variables to dos? |
If I am reading you right, this would be a way to pass variables into a
script in DOS. Just run with cscript mytest.vbs arg1 arg2 You can get
more fancy if you want with error checking.
*****************mytest.vbs*************************************
Set Argc = Wscript.Arguments
Set Argv = Wscript.Arguments
If Argc.Count Then ' If greater than one then do this.
Select Case Argc.Item(0)
Case "Var1" WSHShell.Popup Argc.Item(0) & sMsg, 1,
"Notice", 64
Case "Var2" WSHShell.Popup Argc.Item(1) & sMsg, 1,
"Notice", 64
End Select
Else ' No args found
On Error Resume Next
Err.Raise 1 ' Raise an overflow error.
Wscript.Echo "No variable found"
Err.Clear ' Clear the error
Wscript.Quit()
End If
************************************************************************
****
*********
Quote:
> I am just getting started with scripting and would like to use a very
basic
> script to add the username on a 95/98 workstation logging into a NT
Server
> to a variable and then run a batch file that would be able to use that
> variable.
> I can get the username and display it with the script, but how do you
make
> the variable accessable to dos?
> Thanks for any help,
> George Rose