Batch file cannot find .vbs script.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
wchristner
Posts: 24
Joined: 06 May 2014 09:55
Location: North West Indiana

Batch file cannot find .vbs script.

#1 Post by wchristner » 11 May 2016 10:59

OK I have condensed my script down to one line. It calls a .vsb file that dose install a printer.
My issues is when i run the .vbs script locally on my computer everything works and all is well.
If I try to run this in a batch script calling the .vbs from a network folder location, (there are no restrictions or permissions on the network folder) I get an error that the .vbs cannot be found.
I am the system admin on this machine, and have tried launching this batch with the "run as administrator" option. still I get the same error.
If someone had tried somthing like this and or had some ideas on what could be causing this, please let me know.

here is my code:

Code: Select all

@echo.
wscript "\\bh-miworks-srv2\PrintDrivers\Printers\Benton Harbor\Benton Harbor\Dockside.vbs"
@echo.


Here is my error:
---------------------------
Windows Script Host
---------------------------
Can not find script file "\\bh-miworks-srv2\PrintDrivers\Printers\Benton Harbor\Benton Harbor\Dockside.vbs".

---------------------------
OK
---------------------------

Thanks Again :D

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Batch file cannot find .vbs script.

#2 Post by foxidrive » 11 May 2016 13:04

Run this batch file for diagnostic information: The error you see is saying that the location doesn't exist or the file doesn't exist.

Code: Select all

@echo off
dir "\\bh-miworks-srv2"
pause
dir  "\\bh-miworks-srv2\PrintDrivers\Printers\Benton Harbor\Benton Harbor"
pause
dir "\\bh-miworks-srv2\PrintDrivers\Printers\Benton Harbor\Benton Harbor\*.vbs"
pause

wchristner
Posts: 24
Joined: 06 May 2014 09:55
Location: North West Indiana

Re: Batch file cannot find .vbs script.

#3 Post by wchristner » 13 May 2016 09:06

OK I ran your test and here is the result:

dir: "\\-miworks-srv2"
The filename, directory name, or volume label syntax is incorrect.

dir "\\bh-miworks-srv2\PrintDrivers\Printers\Benton Harbor"
Volume in drive \\bh-miworks-srv2\PrintDrivers is Data2
Volume Serial Number is 924F-3AF9

dir "\\bh-miworks-srv2\PrintDrivers\Printers\Benton Harbor\Benton Harbor\*.vbs"
The system cannot find the file specified.

Weird it can find the info for "\\bh-miworks-srv2\PrintDrivers\Printers\Benton Harbor"
but that's it?

I created a new batch file, copied and pasted it, ran as administrator, and as local user. Same result. What dose this tell you?

Thanks

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Batch file cannot find .vbs script.

#4 Post by Squashman » 13 May 2016 09:24

wchristner wrote:dir: "\\-miworks-srv2"
The filename, directory name, or volume label syntax is incorrect.

dir "\\bh-miworks-srv2\PrintDrivers\Printers\Benton Harbor"
Volume in drive \\bh-miworks-srv2\PrintDrivers is Data2
Volume Serial Number is 924F-3AF9

Not the same code that Foxidrive told you to run.

wchristner
Posts: 24
Joined: 06 May 2014 09:55
Location: North West Indiana

Re: Batch file cannot find .vbs script.

#5 Post by wchristner » 13 May 2016 14:05

I copied the script exactly I didn't type dir: I used the : as a way of organizing command from output, for readability for this fourm. then I just dident use : with the other commands in the replay.....its been a long day. It's an old habit, but I simply cut and copied the 3 lines and got the same result. Thanks

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Batch file cannot find .vbs script.

#6 Post by Squashman » 13 May 2016 14:36

wchristner wrote:I copied the script exactly I didn't type dir: I used the : as a way of organizing command from output, for readability for this fourm. then I just dident use : with the other commands in the replay.....its been a long day. It's an old habit, but I simply cut and copied the 3 lines and got the same result. Thanks


Execute all three commands in one cmd window and then copy and paste ALL the text from the cmd window into a forum post.

wchristner
Posts: 24
Joined: 06 May 2014 09:55
Location: North West Indiana

Re: Batch file cannot find .vbs script.

#7 Post by wchristner » 13 May 2016 14:51

OK I ran this exact script

Code: Select all

@echo off
dir "\\bh-miworks-srv2"
pause
dir  "\\bh-miworks-srv2\PrintDrivers\Printers\Benton Harbor\Benton Harbor"
pause
dir "\\bh-miworks-srv2\PrintDrivers\Printers\Benton Harbor\Benton Harbor\*.vbs"
pause



This is the result

The filename, directory name, or volume label syntax is incorrect.
Press any key to continue . . .
Volume in drive \\bh-miworks-srv2\PrintDrivers is Data2
Volume Serial Number is 924F-3AF9

Directory of \\bh-miworks-srv2\PrintDrivers\Printers\Benton Harbor

File Not Found
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Batch file cannot find .vbs script.

#8 Post by penpen » 14 May 2016 11:25

I doubt that, and according to your last posts i assume you have run this script:

Code: Select all

@echo off
dir: "\\-miworks-srv2"
pause
dir "\\bh-miworks-srv2\PrintDrivers\Printers\Benton Harbor"
pause
dir "\\bh-miworks-srv2\PrintDrivers\Printers\Benton Harbor\Benton Harbor\*.vbs"
pause
If you cannot see any differences betweeen the two scripts, then use another internet browser
(for example "Internet Explorer", or "Mozilla Firefox").

I also suspect, that you have used the variable "DIRCMD".

In addition, i recommend to add the following lines to the script from foxidrive:

Code: Select all

dir "\\bh-miworks-srv2\PrintDrivers\Printers\Benton Harbor\Benton Harbor\*.vbs*"
pause
set "dircmd"
pause


penpen

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Batch file cannot find .vbs script.

#9 Post by foxidrive » 15 May 2016 18:38

wchristner wrote:OK I ran your test and here is the result:

dir: "\\-miworks-srv2"
The filename, directory name, or volume label syntax is incorrect.


Do you see the - sign after \\

You had advice it wasn't the same code so the first diagnostic step in programming is to copy and paste the code again - to double check.

Directory of \\bh-miworks-srv2\PrintDrivers\Printers\Benton Harbor

File Not Found


This line is telling you that there is no file in that folder with the extension .vbs or it has a hidden/system attribute. You can verify that by manually browsing to the folder.

Post Reply