Preferred way to run an application as the currently logged on user

I was wondering what the preferred way of running an action as the currently logged on user is. I am running into an issue with the RunAsCurrentUser utility. It seems to get hung up and keeps running even though I specified runhidden vs. waithidden in the launching of another utility:

runhidden __Download\RunAsCurrentUser- --w --q “C:\Utils\AutoHotkey.exe”

The above AutoHotkey.exe process should stay running once it is launched as it is used for custom hotkeys however I don’t want the RunAsCurrentUser to stay running indefinitely as it causes the download folder of the site to not be clear able with subsequent fixlets that require file downloads. We are on version if that matters.

@jgallas You may want to look into using the override command in your action script. It is documented here:

One of the keyword/value options available is runas=currentuser, which mimics the RunasCurrentUser executable.

You might try this actionscript in place of the runhidden command you’re currently using:

override run
run C:\Utils\AutoHotKey.exe



That worked great thanks!


Hi Jason,

Glad to hear it - wasn’t 100% sure about the detached option.

I wasn’t so sure either, I haven’t often needed to run things as the user.

A brief word of caution, your use case seems clear but for anyone else reading, be sure to copy (not move) your application out of __Download before running it, else the __Download folder may stay locked and the next action won’t be able to download its files.

Agreed - that was the problem @jgallas encountered with running the RunAsCurrentUser.exe from __Download.

Yes good point and good practice. I think the RunAsCurrentUser executable requires an exit code to complete. Since my application needed to stay running and did not provide it that is where the problem occurred. Copying it and running it from a different location other than the download folder would have also resolved the problem.