|
-
Jan 31st, 2011, 07:23 AM
#1
Thread Starter
New Member
VBS Run command - help required
Hello everyone,
I'm trying to run following CMD command using VBS Run.
Exe file is under directory: c:\Program Files\O T A\ota.exe
CMD:
c:\cd Program Files
c:\Program Files\cd O A T
c:\Program Files\O A T\oat.exe /Auto /T:A /AP:20020303-20020403A /DA:"xxxx" /SA:"yyyy" /Unread:Y
VBS:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run ("CMD /K ""c:\Program Files\O A T\oat.exe""" & "/Auto /T:A /AP:20020303-20020403A /DA:""xxxx"" /SA:""yyyy"" /Unread:Y")
From my own thoughts there are problems with quotes which appearing in parameters of the program.
Unfortunately I'm getting error: 'C:\Program' is not recognised as an internal or external command, operable program or batch file.
Thanks in advance for help.
Regards,
Wojciech
-
Jan 31st, 2011, 08:22 AM
#2
Re: VBS Run command - help required
Does this work?
Code:
Dim WshShell
Dim sPath, sParams
sPath = Chr(34) & "c:\Program Files\O A T\oat.exe" & Chr(34)
sParams = " /Auto /T:A /AP:20020303-20020403A /DA:" & Chr(34) & "xxxx" & Chr(34) & " /SA:" & Chr(34) & "yyyy" & Chr(34) & " /Unread:Y"
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run ("CMD /K " & sPath & sParams)
-
Jan 31st, 2011, 08:33 AM
#3
Thread Starter
New Member
Re: VBS Run command - help required
Unfortunately not, It gave exactly same error.
Regards,
Emacs
-
Jan 31st, 2011, 10:15 AM
#4
Thread Starter
New Member
Re: VBS Run command - help required
OK I work around this using bat file. If someone will have same problem below is a sample code.
Code:
Dim strBat1, strBat2, batFile, fso
strUser = "KimK"
Set fso = CreateObject("Scripting.FileSystemObject")
Set batFile = fso.CreateTextFile("battest.bat",True)
strBat1 = "cd /D C:\Program Files\O T A"
strBat2 = "START OTA.exe /Auto /T:A /AP:20080101-20080630A /SA:""" & strUser & _
""" /DA:""" & strUser & "_2008_Jan-Jun""" & " /Unread:Y"
batFile.WriteLine strBat1
batFile.WriteLine strBat2
batFile.Write
batFile.Close
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run ("CMD /K ""C:\Program Files\O T A\battest.bat""")
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|