Computing.Net > Forums > Programming > Launch a new script within a .cmd f

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Launch a new script within a .cmd f

Reply to Message Icon

Name: paultown
Date: October 28, 2004 at 19:05:19 Pacific
OS: WIN NT4
CPU/Ram: Pentium 4 1.2Ghz 512MG RA
Comment:

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...

Paul...



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Launch a new script within a .cmd f

Can I speed up my Batch script? www.computing.net/answers/programming/can-i-speed-up-my-batch-script/14412.html

Copy and rename with a batch script www.computing.net/answers/programming/copy-and-rename-with-a-batch-script/14966.html

Run a cmd in a logged out machine www.computing.net/answers/programming/run-a-cmd-in-a-logged-out-machine/4978.html