Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


How to run windows native commands

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> How to run windows native commands
  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 >>
 How to run windows native commands - 4/14/2004 12:20:35 AM   
  babujee_recw

 

Posts: 1
Score: 0
Joined: 4/14/2004
From: India
Status: offline
How to run windows native commands(like 'DIR','COPY') using vbscript

BABUJEE, HYDERABAD
 
 
Post #: 1
 
 Re: How to run windows native commands - 4/22/2004 11:03:25 PM   
  stophon4

 

Posts: 2
Score: 0
Joined: 4/16/2004
From:
Status: offline
Not that I know but I don't think you can

I know the following script languages:
HTML
JavaScript
PHP
and I am trying to learn VBscript

(in reply to babujee_recw)
 
 
Post #: 2
 
 Re: How to run windows native commands - 6/23/2004 1:29:57 AM   
  garyinarush

 

Posts: 1
Score: 0
Joined: 6/23/2004
From: United Kingdom
Status: offline
Try the following:

'Start the WordPad application
WshShl.Run "WordPad"

Alternativly the following will run a batch file which can contain commands of your choice. The WScript.Sleep 3000 allows the batch file to complete before the .vbs continues...

Dim oShell
Set oShell = WScript.CreateObject ("WScript.shell")
oShell.run "c:\prepare.bat"
Set oShell = Nothing
WScript.Sleep 3000


Hope this helps

(in reply to babujee_recw)
 
 
Post #: 3
 
 Re: How to run windows native commands - 6/24/2004 1:32:47 AM   
  mbouchard


Posts: 1922
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
use CMD for NT and above or Command for 9x

WshShell.Run "CMD /C dir c:\ >> c:\diroutput.txt",1,TRUE
/C will close the CMD prompt window when it completes

WshShell.Run "CMD /K dir c:\ >> c:\diroutput.txt",1,TRUE
/K will leave the CMD prompt window open until you close it, thus stopping the script.

You can use most DOS commands this way. I use xcopy extensivly in my scripts, you just may need to figure out "'s though as it can be a pain.

(in reply to babujee_recw)
 
 
Post #: 4
 
 Re: How to run windows native commands - 6/24/2004 1:34:45 AM   
  mbouchard


Posts: 1922
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Gary,

As a followup to your post, if you put a ,1,TRUE on the end of the line to launch your BAT file the Script would wait for the BAT file to be completed before continuing.

ie oShell.run "c:\prepare.bat",1,TRUE

(in reply to babujee_recw)
 
 
Post #: 5
 
 
 
  

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 >> How to run windows native commands 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