How to code run-as-admin?

asked 2022-06-02T05:16:05.797+00:00
Sean Oar 21 Reputation points

I've created a C# console app with Visual Studio to run cleanmgr, and it worked.

However, there are a couple of things which I failed to figure out:

  1. I couldn't find a way to run it as admin. Like what happened when I open an elevated cmd and run the command.
  2. The command I want is actually not cleanmgr, but "cleanmgr /d c". I couldn't code this.

I'd appreciate your help!

Universal Windows Platform (UWP)
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. answered 2022-06-02T05:47:59.247+00:00
    Castorix31 65,246 Reputation points