tags:

views:

27

answers:

2

hi I am try to run the go.bat from VB but when I run the script I get: :cant find specific file

but from the cmd window the file go.bat exsit what the problem?

Dim MyShell

Dim shell_cmd

shell_cmd = "C:\Program Files\dir1\dir2\wizard\go.bat"

set MyShell = CreateObject("WScript.Shell")

MyShell.Run shell_cmd, 1, 1

from cmd window

C:\Program Files\dir1\dir2\wizard>go.bat

A: 

Hi!

not sure if you knew but in vb you can use the Shell function:

http://msdn.microsoft.com/en-us/library/xe736fyk(VS.71).aspx

(seems easier than what you're using)

I don't know why you get this message, but the two paths you mention are in fact different:

C:\Program Files\dir1\dir2\wizard\go.bat
C:\Program Files\dir1\dir2\wizard>go.bat
                                 ^
Roland Bouman
The second thing was from a command prompt window, apparently, according to the question, so the working directory was `C:\Program Files\dir1\dir2\wizard` and they were executing `go.bat` from there.
icktoofay
no they are the same C:\Program Files\dir1\dir2\wizard>go.bat go.bat is under wizard directory
yael
A: 

Your batch file's full path contains spaces, so you need to enclose it in double quotes, like this:

shell_cmd = """C:\Program Files\dir1\dir2\wizard\go.bat"""

or

shell_cmd = Chr(34) & "C:\Program Files\dir1\dir2\wizard\go.bat" & Chr(34)
Helen
hi THX allot its work greatTHX again
yael