Discussion:
Invoke VS.NET Command prompt from VBS file
(too old to reply)
Lakshmi Subramanian
2004-02-12 02:54:36 UTC
Permalink
Hi,
I am trying to invoke a vs.net command prompt from a
vbs file. Following is the code.
Dim WshShell
Set WshShell = Wscript.CreateObject("WScript.shell")
str = "cmd /c cscript " & "%comspec% /k" & "C:\Program
Files\Microsoft Visual Studio .NET\Common7
\Tools\vsvars32.bat"
return1 = WshShell.Run(str, 2, True)
str = str & "sn -k a.snk"
return1 = WshShell.Run(str, 2, True)

This does start the VS.NET command prompt, but does not
execute the command in it, but returns an error code.
Please let me know how to get this done.

Thanks and Regards,
Lakshmi.S
Björn Holmgren
2004-02-13 09:27:01 UTC
Permalink
What on earth are you trying to do?

Your code says: Execute cmd.exe and tell it to run cscript.exe which in turn
should execute cmd.exe and tell it to run a batch file. Cscript.exe cannot
possibly execute cmd.exe (because that's not a script).

If you're simply trying to execute the vsvars32.bat file, then remove
everything before the "%comspec% /k" sequence. Note also that you have not
included the required space after the /k qualifier. You may also have to
enclose the path in double quotation marks since it contains spaces.

HTH
--
Björn Holmgren
Guide Konsult AB
Post by Lakshmi Subramanian
Hi,
I am trying to invoke a vs.net command prompt from a
vbs file. Following is the code.
Dim WshShell
Set WshShell = Wscript.CreateObject("WScript.shell")
str = "cmd /c cscript " & "%comspec% /k" & "C:\Program
Files\Microsoft Visual Studio .NET\Common7
\Tools\vsvars32.bat"
return1 = WshShell.Run(str, 2, True)
str = str & "sn -k a.snk"
return1 = WshShell.Run(str, 2, True)
This does start the VS.NET command prompt, but does not
execute the command in it, but returns an error code.
Please let me know how to get this done.
Thanks and Regards,
Lakshmi.S
Loading...