Hi,

I'm trying to rewrite a batch file that I have used for quite some time into
a VBScript script.

I have ran into a problem though... I have a command that
calls Visual Source Safe (VSS) via command line parameters. For VSS to work
properly with command lines, one must set an environment variable that holds
the user's ID.

For example, in the bat file, one would code this as:

SET ssuser=billg
"C:\Program Files\Microsoft Visual Studio\VSS\win32\ss.exe" get
"$/BigProject" -GLc:\CompileBigProject\ -I-

If the 'ssuser' environment variable is not set, then when SS.exe is ran, it
asks for the user's ID. I have not been able to figure out how to run
SS.EXE and pass it the user's ID, other than with an environment variable.

So, how would be the best way to code this in a script? Any help would be
greatly appreciated.

thanks,
joe

Re: Setting an OS environment variable in a script? by Torgeir

Torgeir
Fri Jan 07 03:44:08 CST 2005

JG wrote:

> Hi,
>
> I'm trying to rewrite a batch file that I have used for quite some time into
> a VBScript script.
>
> I have ran into a problem though... I have a command that
> calls Visual Source Safe (VSS) via command line parameters. For VSS to work
> properly with command lines, one must set an environment variable that holds
> the user's ID.
>
> For example, in the bat file, one would code this as:
>
> SET ssuser=billg
> "C:\Program Files\Microsoft Visual Studio\VSS\win32\ss.exe" get
> "$/BigProject" -GLc:\CompileBigProject\ -I-
>
> If the 'ssuser' environment variable is not set, then when SS.exe is ran, it
> asks for the user's ID. I have not been able to figure out how to run
> SS.EXE and pass it the user's ID, other than with an environment variable.
>
> So, how would be the best way to code this in a script? Any help would be
> greatly appreciated.
Hi

Two alternatives:

1)
'--------------------8<----------------------
Set oShell = CreateObject("WScript.Shell")
Set oWshProcessEnv = oShell.Environment("process")

oWshProcessEnv("ssuser") = "billg"

sCmd = """%ProgramFiles%\Microsoft Visual Studio\VSS\win32\ss.exe""" _
& " get ""$/BigProject"" -GLc:\CompileBigProject\ -I-"

oShell.Run sCmd, 1, False
'--------------------8<----------------------


2)

'--------------------8<----------------------
Set oShell = CreateObject("WScript.Shell")

sCmd = "%comspec% /c SET ssuser=billg & " _
& """%ProgramFiles%\Microsoft Visual Studio\VSS\win32\ss.exe""" _
& " get ""$/BigProject"" -GLc:\CompileBigProject\ -I-"

oShell.Run sCmd, 0, False
'--------------------8<----------------------


--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

Re: Setting an OS environment variable in a script? by JG

JG
Fri Jan 07 08:24:48 CST 2005

Thank you, thank you, thank you!!!

I'll try this out...

Regards,
joe


"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:%23Otj71J9EHA.2316@TK2MSFTNGP15.phx.gbl...
> JG wrote:
>
> > Hi,
> >
> > I'm trying to rewrite a batch file that I have used for quite some time
into
> > a VBScript script.
> >
> > I have ran into a problem though... I have a command that
> > calls Visual Source Safe (VSS) via command line parameters. For VSS to
work
> > properly with command lines, one must set an environment variable that
holds
> > the user's ID.
> >
> > For example, in the bat file, one would code this as:
> >
> > SET ssuser=billg
> > "C:\Program Files\Microsoft Visual Studio\VSS\win32\ss.exe" get
> > "$/BigProject" -GLc:\CompileBigProject\ -I-
> >
> > If the 'ssuser' environment variable is not set, then when SS.exe is
ran, it
> > asks for the user's ID. I have not been able to figure out how to run
> > SS.EXE and pass it the user's ID, other than with an environment
variable.
> >
> > So, how would be the best way to code this in a script? Any help would
be
> > greatly appreciated.
> Hi
>
> Two alternatives:
>
> 1)
> '--------------------8<----------------------
> Set oShell = CreateObject("WScript.Shell")
> Set oWshProcessEnv = oShell.Environment("process")
>
> oWshProcessEnv("ssuser") = "billg"
>
> sCmd = """%ProgramFiles%\Microsoft Visual Studio\VSS\win32\ss.exe""" _
> & " get ""$/BigProject"" -GLc:\CompileBigProject\ -I-"
>
> oShell.Run sCmd, 1, False
> '--------------------8<----------------------
>
>
> 2)
>
> '--------------------8<----------------------
> Set oShell = CreateObject("WScript.Shell")
>
> sCmd = "%comspec% /c SET ssuser=billg & " _
> & """%ProgramFiles%\Microsoft Visual Studio\VSS\win32\ss.exe""" _
> & " get ""$/BigProject"" -GLc:\CompileBigProject\ -I-"
>
> oShell.Run sCmd, 0, False
> '--------------------8<----------------------
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
> http://www.microsoft.com/technet/scriptcenter/default.mspx