Julien.alkaza Posted November 25, 2005 Posted November 25, 2005 (edited) Hello everybody... I'm trying to make a little script to add shared printers automaticly at session opening... So, while searching on this forum, i found adprintx which lets me add network printers. The problem is that when I have to install a printer my command line is : adprintx /c "\\myserver\myprinter" And when I use Run command, the external program must be between " and ". Can I escape " caracter, or is there a solution to not use " in the command???? Thanks a lot... Edit : this is not RunAs command, but Run Edited November 25, 2005 by Julien.alkaza What????????
LxP Posted November 25, 2005 Posted November 25, 2005 Welcome to the forums!You can also surround a string with single quotes:Run('adprintx /c "\\myserver\myprinter"')
Julien.alkaza Posted November 25, 2005 Author Posted November 25, 2005 (edited) Thanks.... I tried to put singlequote around my command, but it doesn't work!!! There is no error, but no more printer! Run ('D:\ADPRINTX.exe /c "\\printserver\HP4050"') Is there any other solution to do it?? Edited November 25, 2005 by Julien.alkaza What????????
LxP Posted November 25, 2005 Posted November 25, 2005 Perhaps you are issuing a command after the Run() that relies on the printer being added.You could try changing the Run() to RunWait(); if that doesn't work then I would suggest opening a command prompt (DOS box) and typing the exact same command there. Perhaps an error message will be shown.
Nuffilein805 Posted November 25, 2005 Posted November 25, 2005 try: #include <Process.au3> _RunDos('D:\ADPRINTX.exe /c "\\printserver\HP4050"') this should work good luck my little chatmy little encryption toolmy little hidermy unsafe clickbot
Julien.alkaza Posted November 25, 2005 Author Posted November 25, 2005 No, no, no & no!!!!! Here is my exact code : #include <Process.au3> RunAsSet ( "Administrator", @Computername, "pass") _RunDos('D:\ADPRINTX.exe /c "\\printserver\HP4050-Can"') RunAsSet() There is no error...Nothing happens!!! When I use only command prompt with : D:\ADPRINTX.exe /c "\\printserver\HP4050-Can" It works!! I don't know where is the problem!!!! Thanks a lot!! What????????
Nuffilein805 Posted November 25, 2005 Posted November 25, 2005 just do a little cmd-thingy run("cmd") opt("wintitlematchmode", 4) WinWaitActive ("classname=ConsoleWindowClass") send(''D:\ADPRINTX.exe /c "\\printserver\HP4050-Can"{enter}') this should work my little chatmy little encryption toolmy little hidermy unsafe clickbot
Julien.alkaza Posted November 25, 2005 Author Posted November 25, 2005 All right!!!! It's working well.... Thanks to everybody!!! Julien What????????
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now