Jump to content
Sign in to follow this  

Runas Question... / "Start In "Directory Question

Recommended Posts



I am new to AutoIt, so I am sure this is something simple that I just don't understand. I did try searching but couldn't find what I was looking for... So thanks for the help.

Basically, I have an application that sits out on the network. I need to run it as a domain admin in Windows 7 for the app to work correctly. The issue (I think) is that even though I execute it from the network, it "starts in" a local directory, and depends on those local files to execute properly.

Here is my (very basic) script, which does launch the app as an admin just fine, but the app fails because it can't find the local files it needs (or so I think.)

RunAs ( "Administrator", "<domain>", "<password>", 4, "\\<servername>\Cadence\Factors.exe Cadence" )

I know that you can add a "working directory" to the end of this - but I couldn't get that to work properly. Is the working directory the same as the "start in" directory? And if it is, can someone help explain how to use it?

Note: If I launch this program by first holding shift, right clicking, and doing run-as, it will run fine after entering my domain admin credentials. The properties of the shortcut show it pointing to the .exe on the network, and below that it says "Start In" and has a local directory. See attached photo.

Sorry if this is a lame question, but I honestly had no luck with the search. Thanks again.


Share this post

Link to post
Share on other sites

Well it was something simple, I figured out the working directory question easily enough.

RunAs ( "Administrator", "<domain>", "<password>=", 1, "\\<servername>\Cadence\Factors.exe Cadence", "C:\Program Files\Cadence" )

I think that is all proper, and specifies the correct working directory. Unfortunately it didn't solve my issue.

The app will run as an administrator, but the app itself an "app manager" for other programs. When I try to launch those other programs they fail. If I try to run the programs directly outside the app manager, as any user, they fail saying they need to be opened from the app manager. Very lame.

What I don't understand is, why does the program work flawlessly if I right click the icon and choose "Run As User" and enter domain admin credentials? Shouldn't that be the exact same thing as saying "RunAs" in AutoIt? :graduated:

Edited by TheSquareRootOf

Share this post

Link to post
Share on other sites
Richard Robertson

The "start in" directory on a shortcut is exactly the same as the initial working directory.

RunAs("Administrator", "<domain>", "<password>", 1, "\\<servername>\Cadence\Factors.exe Cadence", "\\<servername>\Cadence")
Edited by Richard Robertson

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.