1.

Solve : Launch a new script within a .cmd file??

Answer»

Hopefully a easy question for you guys,
I WANT to launch a JAVA script within a .cmd file so I can add a printer on a remote workstation.
Basically I have no IDEA on how to do this. I have found a script that I saved as a .VBS to add a printer on a local workstation but would like to amplify this so it works on a remote workstation.
The code I have come up with is this but it doesn't work:-
*********************************************
echo off
cls
echo Add Printer %2 on %1
echo.

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

psexec \\%1 -i -d -s notepad

Dim net
Set net = CreateObject("WScript.Network")
net.AddWindowsPrinterConnection "%2"


:Syntax
echo Adds a printer on the target workstation
echo.
echo USAGE: Printer [Computername] [\\Server\Printer]
echo.

:End
pause
*********************************************
This works up until psexec launches notepad on the remote workstation.

What I would like to know is how to add the the Bold code to the notepad window that launched and then to save it on the workstation as a .vbs file. I think then I will be able to figure out the rest.

Is this possible?
Any replies would be very helpfull...



Discussion

No Comment Found