|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How do you launch a vbscript within vb.net?The script itself requires a parameter of a filename to process. I have tried: Dim P As Process = Process.Start("C:\Temp\MyTest.vbs", "MyFileToProcess.txt") also Dim P As Process = Process.Start("C:\winnt\system32\cscript.exe", "C:\Temp\MyTest.vbs MyFileToProcess.txt") also Dim P As Process = Process.Start("C:\winnt\system32\wscript.exe", "C:\Temp\MyTest.vbs MyFileToProcess.txt") In all cases the process starts but the script never runs. The files are in the correct location. Is there some better way in VS2005 to start a vbscript and pass it a parameter?
Show quote
Hide quote
"Patrick Dugan" <patrick.dugan@usnetNOSMORESPAMcomcorp.com> wrote in message Using the last Process.Start, without only a path modification to point to news:%23inFpDgbGHA.3900@TK2MSFTNGP05.phx.gbl... >I am trying to launch a vbscript from within vb.net (vs2005) > The script itself requires a parameter of a filename to process. > > I have tried: > > Dim P As Process = Process.Start("C:\Temp\MyTest.vbs", > "MyFileToProcess.txt") > > also > > Dim P As Process = Process.Start("C:\winnt\system32\cscript.exe", > "C:\Temp\MyTest.vbs MyFileToProcess.txt") > > also > > Dim P As Process = Process.Start("C:\winnt\system32\wscript.exe", > "C:\Temp\MyTest.vbs MyFileToProcess.txt") > > > In all cases the process starts but the script never runs. The files are > in the correct location. Is there some better way in VS2005 to start a > vbscript and pass it a parameter? > > > Windows\System32 since I'm running win2k, it runs fine for me. I created a vbs called MyTest.vbs and ran it. I placed the following code in MyTest.vbs: Option Explicit Dim args Dim arg Set args = WScript.Arguments For Each arg In args WScript.Echo arg Next The following is my Main method: Public Shared Sub Main() Dim p As Process = Process.Start("C:\windows\system32\wscript.exe", "C:\Temp\MyTest.vbs MyFileToProcess.txt") End Sub HTH, Mythran
Show quote
Hide quote
"Patrick Dugan" <patrick.dugan@usnetNOSMORESPAMcomcorp.com> wrote in message Oh, another thing ...news:%23inFpDgbGHA.3900@TK2MSFTNGP05.phx.gbl... >I am trying to launch a vbscript from within vb.net (vs2005) > The script itself requires a parameter of a filename to process. > > I have tried: > > Dim P As Process = Process.Start("C:\Temp\MyTest.vbs", > "MyFileToProcess.txt") > > also > > Dim P As Process = Process.Start("C:\winnt\system32\cscript.exe", > "C:\Temp\MyTest.vbs MyFileToProcess.txt") > > also > > Dim P As Process = Process.Start("C:\winnt\system32\wscript.exe", > "C:\Temp\MyTest.vbs MyFileToProcess.txt") > > > In all cases the process starts but the script never runs. The files are > in the correct location. Is there some better way in VS2005 to start a > vbscript and pass it a parameter? > > > Does the path to the script have spaces in it? If it does, you will need to wrap the path in double-quotes: Dim p As Process = Process.Start( _ "C:\winnt\system32\wscript.exe", """C:\Temp\MyTest.vbs"" MyFileToProcess.txt" _ ) HTH, Mythran Thanks! Yes the path does have spaces in the both the location of the
vbscript and the location of the file the script uses. I'll try the double quote method. Thanks again Show quoteHide quote "Mythran" <kip_potter@hotmail.comREMOVETRAIL> wrote in message news:%23$xcwSgbGHA.4112@TK2MSFTNGP03.phx.gbl... > > "Patrick Dugan" <patrick.dugan@usnetNOSMORESPAMcomcorp.com> wrote in > message news:%23inFpDgbGHA.3900@TK2MSFTNGP05.phx.gbl... >>I am trying to launch a vbscript from within vb.net (vs2005) >> The script itself requires a parameter of a filename to process. >> >> I have tried: >> >> Dim P As Process = Process.Start("C:\Temp\MyTest.vbs", >> "MyFileToProcess.txt") >> >> also >> >> Dim P As Process = Process.Start("C:\winnt\system32\cscript.exe", >> "C:\Temp\MyTest.vbs MyFileToProcess.txt") >> >> also >> >> Dim P As Process = Process.Start("C:\winnt\system32\wscript.exe", >> "C:\Temp\MyTest.vbs MyFileToProcess.txt") >> >> >> In all cases the process starts but the script never runs. The files are >> in the correct location. Is there some better way in VS2005 to start a >> vbscript and pass it a parameter? >> >> >> > > Oh, another thing ... > > Does the path to the script have spaces in it? If it does, you will need > to wrap the path in double-quotes: > > Dim p As Process = Process.Start( _ > "C:\winnt\system32\wscript.exe", > """C:\Temp\MyTest.vbs"" MyFileToProcess.txt" _ > ) > > HTH, > Mythran > >
Re: making datareaders
Substring question vb.net, so slow !!!??? General Question About Web Apps, VB/ASP? Support for multiple database msmapi32.ocx Accessing existing Excel Workbook from complete path VB2005 Short address pointer How to control Bluetooth? Screen Scraper that does Automated data entry. |
|||||||||||||||||||||||