Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call an exe in script

Status
Not open for further replies.
Joined
May 29, 2004
Messages
1,336
Location
GB
I want an exe proram to run at logon and then wait a couple of seconds.

\\server\utils\con2prt /f

How do i call it.


Cheers.
 
Hello bohfrevenge2,

It is possible to just .run an executable under unc. It is run on the login m/c under user's credential.
Code:
set wshshell=createobject("wscript.shell")
wshshell.run "\\server\utils\con2prt /f",,true
set wshshell=nothing
(There are variations on intWindowStyle and bWaitOnReturn if needed.)

regards - tsuji
 
Look at the WShell object and the .Run method. If you have a WShell object named oWsh, then this will execute an external app:

oWsh.Run "\\server\utils\con2prt /f", 0, True

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Thanks guys.

Tsuji thanks for your help, i found a solution in the end con2prt is a resource kit utill that allows you to remove all printers at logoff now i can call it i'm away, it will also let you add printers but it's a faf so i'll stick with vbs for adding.

Cheers.
 
bofhrevenges2,

If it suits your case, all the better. I am glad for you. As one of the link I referred to previously:
The rundll32 command provides greater control than older supplemental utilities such as Con2prt.exe, which allowed only for the addition and deletion of networked printer.
That put this series of utility into perspective.

- tsuji
 
I'll have a more detailed look into that, if there is a remove all printers option then i'll try it, but it seems like i have to list all the printers for it to remove and as they arn't always all added depending on user location then it's might not work properly.

My vbs script queries computer name then adds the appropriate printer it's very easy and low maintenance and seems better than other options so the Con2prt.exe prog that runs once and bins all connections is very handy.

Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top