Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Can I run vbs in a batch file?

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Can I run vbs in a batch file?
  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 >>
 Can I run vbs in a batch file? - 8/10/2007 8:33:21 PM   
  sudo911

 

Posts: 2
Score: 0
Joined: 8/10/2007
Status: offline
Hi,

I'm very experienced with batch, however limitations such as not being able to interrogate hardware devices has me using vbs code.

Can I run vbscript directly in my batch files rather than having to shell out to run a vbs file with cscript?

Below is the code I want to use to evaluate the fixed disks in my system:

Option Explicit
set FSO = CreateObject("Scripting.FileSystemObject")
Dim WshShell,FSO,Drv,Dtype,Dfree,Dtot
Dim Dname,Dpct,Dused,Dserial,Dinfo
For Each drv in FSO.Drives
  
   if drv.DriveType=2 then Wscript.Echo "Drive letter: " & drv.DriveLetter
   if drv.Drivetype=2 then Wscript.Echo "Drive type: " & drv.DriveType
Next


Any help greatly appreciated!
 
 
Post #: 1
 
 RE: Can I run vbs in a batch file? - 8/10/2007 11:45:29 PM   
  dm_4ever


Posts: 2663
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
To execute a vbs you will need to use wscript.exe or cscript.exe.

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to sudo911)
 
 
Post #: 2
 
 RE: Can I run vbs in a batch file? - 8/10/2007 11:53:08 PM   
  sudo911

 

Posts: 2
Score: 0
Joined: 8/10/2007
Status: offline
Ok, maybe I'll strart trying to learn vbscript then......

What are the best resources for someone who is used to scripting and is new to vbscript?

I have a load of batch files that I will need to convert......

I'm assuming running external .exe's and reporting the returncode from execution is all possible?

Sudo.

(in reply to dm_4ever)
 
 
Post #: 3
 
 RE: Can I run vbs in a batch file? - 8/10/2007 11:58:52 PM   
  dm_4ever


Posts: 2663
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
Look at the links in my signature that have other useful links or examples.

Yes, you can run .exe's and get their returncode. Look at WSHShell and the Run Method.

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to sudo911)
 
 
Post #: 4
 
 
 
  

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 >> Can I run vbs in a batch file? 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