Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Trying to launch a file through .cmd on remote PC  (Read 3610 times)

0 Members and 1 Guest are viewing this topic.

Paul Townsend

  • Guest
Trying to launch a file through .cmd on remote PC
« on: November 04, 2004, 07:32:20 PM »
@echo off
cls
echo Add Printer \\%2\%3 on %1
echo _______________________________________ _____
echo.

if {%1}=={} goto HowTo
if {%2}=={} goto HowTo

CALL
>>\\%1\c$\temp\printer.vbs ECHO '-------------------------------------------
>>\\%1\c$\temp\printer.vbs ECHO ' Printer Install for network printer:
>>\\%1\c$\temp\printer.vbs ECHO ' %2
>>\\%1\c$\temp\printer.vbs ECHO '-------------------------------------------
>>\\%1\c$\temp\printer.vbs ECHO Dim net
>>\\%1\c$\temp\printer.vbs ECHO Set net = CreateObject("WScript.Network")
>>\\%1\c$\temp\printer.vbs ECHO net.AddWindowsPrinterConnection "%2"
>>\\%1\c$\temp\printer.vbs ECHO '-------------------------------------------


psexec -i -d -s \\%1 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
pauseI am trying to launch a file that is created with my .cmd file but pcexec says it cannot find the specified file:-
I need this file to open on the remote system and not on mine.

Here is the code for my .cmd file:-
------------------------------------------------------------------------

Can anybody tell me how to launch the printer.vbs file so that it opens on a remote workstation and not on mine???


merlin_2

  • Guest