Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have created the following batch file that automatically creates a file call printer.vbs on a remote system, but when I try to get psexec to lauch the file I get an error "The system cannot find the file specified."
The file is defidently there and can't understand why it can't be launched.
I tried a variation by getting the batch file to create another batch file that calls for printer.vbs but got the same error.
The code is as follows:-@echo off
cls
echo Add Printer %2 on %1
echo ____________________________________________
echo.if {%1}=={} goto HowTo
if {%2}=={} goto HowToCALL
>>\\%1\c$\apps\nai\printer.vbs E-------------------
>>\\%1\c$\apps\nai\printer.vbs ECHO ' Printer Install for network printer:
>>\\%1\c$\apps\nai\printer.vbs ECHO ' %2
>>\\%1\c$\apps\nai\printer.vbs E-------------------
>>\\%1\c$\apps\nai\printer.vbs ECHO Dim net
>>\\%1\c$\apps\nai\printer.vbs ECHO Set net = CreateObject("WScript.Network")
>>\\%1\c$\apps\nai\printer.vbs ECHO net.AddWindowsPrinterConnection "%2"
>>\\%1\c$\apps\nai\printer.vbs E-------------------Call Wait 10
psexec \\%1 -c c:\apps\nai\printer.vbs
echo Printer %2 has been successfully added on %1.Goto End
:HowTo
echo Adds a printer on the target workstation
echo.
echo Usage: Printer [Computername] [\\Server\Printer]
echo.:End
pause
I added the call wait 10 line just to make sure the file did get created before psexec tried to launch it, but still failed.
I get the following error in the command prompt:-[b]PsExec v1.42 - execute processes remotely
Copyright (C) 2001-2003 Mark Russinovich
www.sysinternals.com
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.C:\WINNT\system32\printer.vbs(8, 1) (null): The system cannot find the file spec
ified.cscript.exe exited on wau34420180 with error code 0.[/b]
Any ideas?
Anyone have any thoughts as to why psexec can't find the file?
Thanks in advancePaul...

NT or programming forums would be more appropriate places for troubleshooting complex batch files running on a DOS emulation in a WinNT environment.
98% of all statistics are made up

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |