Run as admin flag for FSUtil.Run()

Hi. Lately I've been using this function a lot, and I've noticed there's no direct way to run something as admin.
There are workarounds to auto-launch elevated apps, (even keeping stdout through pipes), but IMO that adds complexity. Would it be possible to add a flag or some way to run as admin directly? Obviously this wouldn't bypass UAC or anything like that.
Thanks for your attention!

You should be able to use @admin like in a normal Opus button I think.

That could work in some scenarios, but I don't think it's useful, e.g., when talking about script columns or other event-based actions when there isn't a Command involved.

Not sure I really understand sorry. Are you still talking about FSUtil.Run ?

Yes.

I assume that the suggestion to use @admin works (haven't tested it) if you use it in a user command that implements FSUtil.Run(), making whatever is executed that way within that command run elevated.

But I don't know how that would apply if a script column needs to execute something elevated via FSUtil.Run(). Can you include command's modifiers into columns where no Command object is involved?

Ok I tested something like:

@admin
Run_test

Where Run_test uses FSUtil.Run(), and it does NOT run elevated whatever is executed through that method.

You can create a Command object if one isn't passed to you.

True Leo, but read my comment above. @admin doesn't seem to affect FSUtil.Run().
Or was Jon referring to something else?

Sorry, I was thinking about the Command object the whole time, that'll teach me to answer posts before morning coffee :slight_smile:

We'll add a flag for admin in the next beta.

1 Like