Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


load batch file into vbs

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,65365
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> load batch file into vbs
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 load batch file into vbs - 10/21/2008 9:39:39 PM   
  Tundaroes

 

Posts: 1
Score: 0
Joined: 10/21/2008
Status: offline
Hy,

I want to load an batch file into an vbs script, but is gves an error on the  strCmd when I make an exe of it. Or is there a way to translate the batch file into vbs language.
Is there a way to let this work

script in vb:

strCmd="D:\nokia\register_ic713_QA.bat"
strUser="user"
strPass="passl"
set WshShell=CreateObject("WScript.Shell")
WshShell.Run "runas.exe" & " /u:" & strUser & " " & strCmd
WScript.Sleep 1000
WshShell.Sendkeys strPass & "~"
WshShell.Exec("C:\Program Files\Avaya\IC71\bin\qui.exe")
Set WshShell = Nothing

script in bat:

set SYSDIR=C:\WINDOWS\system32
set DIR=C:\Program Files\Avaya\IC71\bin

cd /d "%SYSDIR%"
%SYSDIR%\Regsvr32.exe /s "%SYSDIR%\tabctl32.ocx"
%SYSDIR%\Regsvr32.exe /s "%SYSDIR%\comdlg32.ocx"
%SYSDIR%\Regsvr32.exe /s "%SYSDIR%\dbgrid32.ocx"
%SYSDIR%\Regsvr32.exe /s "%SYSDIR%\dblist32.ocx"
%SYSDIR%\Regsvr32.exe /s "%SYSDIR%\mci32.ocx"
%SYSDIR%\Regsvr32.exe /s "%SYSDIR%\mscomct2.ocx"
%SYSDIR%\Regsvr32.exe /s "%SYSDIR%\mscomctl.ocx"
%SYSDIR%\Regsvr32.exe /s "%SYSDIR%\mscomm32.ocx"
%SYSDIR%\Regsvr32.exe /s "%SYSDIR%\msflxgrd.ocx"
%SYSDIR%\Regsvr32.exe /s "%SYSDIR%\msinet.ocx"
%SYSDIR%\Regsvr32.exe /s "%SYSDIR%\msmapi32.ocx"
%SYSDIR%\Regsvr32.exe /s "%SYSDIR%\msmask32.ocx"
%SYSDIR%\Regsvr32.exe /s "%SYSDIR%\msrdc20.ocx"
%SYSDIR%\Regsvr32.exe /s "%SYSDIR%\mswinsck.ocx"
%SYSDIR%\Regsvr32.exe /s "%SYSDIR%\richtx32.ocx"
%SYSDIR%\Regsvr32.exe /s "%SYSDIR%\comct332.ocx"
%SYSDIR%\Regsvr32.exe /s "%SYSDIR%\COMCTL32.OCX"
cd /d "%DIR%"
"%DIR%\vtel.exe" -register
cd /d "%DIR%"
%SYSDIR%\Regsvr32.exe /s "%DIR%\Sfttreex.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\Vspell32.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\Webster.OCX"
%SYSDIR%\Regsvr32.exe /s "%DIR%\ttf16.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\Dwsbc32.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\Cshtp32.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\VtelDispatch.dll"
%SYSDIR%\Regsvr32.exe /s "%DIR%\Telephony.dll"
%SYSDIR%\Regsvr32.exe /s "%DIR%\Core.dll"
%SYSDIR%\Regsvr32.exe /s "%DIR%\CallList.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\ChatList.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\EduViewer.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\InfoField.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\PhoneEngine.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\SoftPhoneGui.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\Status.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\TelButton.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\WebEngine.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\ActiveContactViewer.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\Wrapup.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\TaskList.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\TaskLib.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\BlenderClient.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\bs.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\clogin.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\CommCtls.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\desktop.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\pane.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\Prop.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\TreeCtrl.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\wrap.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\XMLParse.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\consolefx.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\ifb.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\ContactHistoryBrowser.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\CHFilter.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\UAD.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\StatusDlg.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\PrompterClient.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\Async.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\dco.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\rw.ocx"
rem %SYSDIR%\Regsvr32.exe /s "%DIR%\layout.ocx"
rem %SYSDIR%\Regsvr32.exe /s "%DIR%\LGEditor.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\WACEngine.ocx"
rem %SYSDIR%\Regsvr32.exe /s "%DIR%\TeCIClient.dll"
rem %SYSDIR%\Regsvr32.exe /s "%DIR%\OutboundAgentCtrl.ocx"
rem %SYSDIR%\Regsvr32.exe /s "%DIR%\ps3monitorctrl.dll"
rem %SYSDIR%\Regsvr32.exe /s "%DIR%\PS3AgentCtrl.dll"
%SYSDIR%\Regsvr32.exe /s "%DIR%\HttpClient.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\MailEngine.ocx"
rem %SYSDIR%\Regsvr32.exe /s "%DIR%\qwdcprop.dll"
%SYSDIR%\Regsvr32.exe /s "%DIR%\QWScripts.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\VespEngine.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\WrapUpEngine.ocx"
%SYSDIR%\Regsvr32.exe /s "%DIR%\AICDEngine.ocx"

cd "C:\Program Files\Avaya\IC71\bin"
vtel -register
 
 
Post #: 1
 
 RE: load batch file into vbs - 10/22/2008 12:50:59 AM   
  ebgreen


Posts: 5251
Score: 31
Joined: 7/12/2005
Status: offline
This line is a problem:

WshShell.Exec("C:\Program Files\Avaya\IC71\bin\qui.exe")

First, you are not accessing any of the text streams from the process so there is no reason to use .Exec. .Run makes more sense. Second, since there is a space in the path you will need to double quote the entire string. There are lots of discussions of this around the site. As for converting the bat to vbs, you certainly could and it wouldn't be terribly hard. It is up to you to decide if it is worth the effort.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to Tundaroes)
 
 
Post #: 2
 
 RE: load batch file into vbs - 10/22/2008 1:01:32 AM   
  TNO


Posts: 1402
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
Another suggestion would be to put a list of the filenames in an array, then loop through the array and prepend the file path/command dynamically. This should cut the size down significantly and let you have just one file to worry about

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to ebgreen)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> load batch file into vbs Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts