Sign in to follow this  
Followers 0
Julien.alkaza

[Newbie!] RunAs with "" in programpath

8 posts in this topic

#1 ·  Posted (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 by Julien.alkaza

What????????

Share this post


Link to post
Share on other sites



Welcome to the forums!

You can also surround a string with single quotes:

Run('adprintx /c "\\myserver\myprinter"')

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks....:graduated:

I tried to put singlequote around my command, but it doesn't work!!! B)

There is no error, but no more printer!

Run ('D:\ADPRINTX.exe /c "\\printserver\HP4050"')

Is there any other solution to do it?? :o

Edited by Julien.alkaza

What????????

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

No, no, no & no!!!!! B)

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!! :o


What????????

Share this post


Link to post
Share on other sites

All right!!!!

It's working well....

Thanks to everybody!!!

Julien


What????????

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0