Page 1 of 1

Batch file cannot find .vbs script.

Posted: 11 May 2016 10:59
by wchristner
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

Re: Batch file cannot find .vbs script.

Posted: 11 May 2016 13:04
by foxidrive
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

Re: Batch file cannot find .vbs script.

Posted: 13 May 2016 09:06
by wchristner
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

Re: Batch file cannot find .vbs script.

Posted: 13 May 2016 09:24
by Squashman
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.

Re: Batch file cannot find .vbs script.

Posted: 13 May 2016 14:05
by wchristner
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

Re: Batch file cannot find .vbs script.

Posted: 13 May 2016 14:36
by Squashman
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.

Re: Batch file cannot find .vbs script.

Posted: 13 May 2016 14:51
by wchristner
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 . . .

Re: Batch file cannot find .vbs script.

Posted: 14 May 2016 11:25
by penpen
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

Re: Batch file cannot find .vbs script.

Posted: 15 May 2016 18:38
by foxidrive
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.