How to open my local MS-DOS batch file 
Author Message
 How to open my local MS-DOS batch file

Can someone help this newbie figure out how to open an MS-DOS batch file
or even a .exe file on my system in a .vbs script?

I tried

Dim DoThis
Set DoThis = GetObject("C:\MyBatch\dosbatch.bat")

but that does not work.  What am I missing? (besides experience and
training in .vbs that is :^)

Darwin
--



Sat, 01 Sep 2001 03:00:00 GMT  
 How to open my local MS-DOS batch file
I'm pretty new to this myself, but try this.  I got the WSHShell stuff
out of the Shortcut.VBS sample script that gets put in the WSH\Samples
directory or somewhere like that.  I found out about the run procedure
from the Microsoft document "Microsoft Windows Scripting Host
PROGRAMMER'S REFERENCE"  I don't recall exactly where on their scripting
site I downloaded it from.  Good luck...

Dim WSHShell
Set WSHShell = WScript.CreateObject("WScript.Shell")
WSHShell.Run("C:\MyBatch\dosbatch.bat")

Here is a copy and paste from that document I mentioned above--copyright
MS I'm sure:

WshShell.Run

The Run method creates a new process that executes strCommand with
window style intWindowStyle.

Syntax
WshShell.Run (strCommand, [intWindowStype], [bWaitOnReturn])

Parameters
strCommand
Environment variables within the strCommand parameter are automatically
expanded.
bWaitOnReturn
If bWaitOnReturn is not specified or FALSE, this method immediately
returns to script execution rather than waiting on the process
termination.
If bWaitOnReturn is set to TRUE, the Run method returns any error code
returned by the application.
If bWaitOnReturn is not specified or is FALSE, Run returns an error code
of 0 (zero).

Example
' This fragment launches Notepad with the current executed script
Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.Run ("notepad " & Wscript.ScriptFullName)
WshShell.Run ("%windir%\notepad" & Wscript.ScriptFullName)

' This fragment returns the error code from the executed application
Return = WshShell.Run("notepad " & Wscript.ScriptFullName, 1, TRUE)

Quote:

> Can someone help this newbie figure out how to open an MS-DOS batch file
> or even a .exe file on my system in a .vbs script?

> I tried

> Dim DoThis
> Set DoThis = GetObject("C:\MyBatch\dosbatch.bat")

> but that does not work.  What am I missing? (besides experience and
> training in .vbs that is :^)

> Darwin
> --



Sat, 08 Sep 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to open my local MS-DOS batch file

2. MAJOR NEWBIE -check file timedatestamp in batch - MS-DOS v VBScript

3. ??? Is a DOS Batch File Better ???

4. Writing international chars to a DOS batch file

5. Call VBScribt with parameter from DOS Batch file

6. Pass Javascript variable to DOS Batch File

7. ??? Is a DOS Batch File Better ???

8. Hiding the cmd (Dos) windows in Batch file

9. Running dos commands, batch files

10. dos batch files & VBscripts

11. VBScript and MSDOS Batch files.

12. PostScript files viewer for MS-DOS

 

 
Powered by phpBB® Forum Software