How to open CMD with administration rights?

Hey everyone, I am trying to send a command in command prompt.

The issue I am facing is that command runs only when we open CMD with runs as administrator.

UiPath is opening the simple CMD but not the other one.

I have tried to open it from wins+R key but it still says access is denied.

Thank you for your time.

@Muhammad_Anas_Baloch

Try running UiPath also in admin mode and then use cmd in admin

Cheers

1 Like

Hi @Muhammad_Anas_Baloch Did you try opening cmd manually? Does it opening with admin rights or no

1 Like

Manually it is working fine @ushu

Didn’t worked for me!

@Muhammad_Anas_Baloch

Are you running both in admin mode

Cheers

That’s the problem dear. UiPath is Unable to open the CMD in admin mode.

@Muhammad_Anas_Baloch

Try creating a bat file with commands and then set it to run as admin from the options …then try calling that file from UiPath

Right click on bat file → options → run as admin check box

Cheers

@Muhammad_Anas_Baloch - Can you give a try by enabling the Run as Administrator in the properties and check how that goes. Step by step process in the below link

Run Command Prompt as Administrator by Default on Windows 10 - Super User

1 Like

I have created the shortcut of CMD on desktop and set it to run as administrator but still it says access is denied @ushu , @Anil_G

@Muhammad_Anas_Baloch

With shortcut of cmd it would not work…as you would ideally give the original pocation only…

Create a .bat file and set that to run as admin and call that bat file from UiPath using start process or use application/browser and that bat file would run as admin as you would set it to run

Cheers

Can you please let me know how to create that .bat file and what will be inside in that .bat file?

@Muhammad_Anas_Baloch

Basically whatever you want to run in cmd …you can save those commands in a notepad and then save that file with .bat extension…when you double click that file the command you want to run will run in cmd by default…

So you can have your commands in text file and then save as .bat and use

Cheers

2 Likes

Okay I will do this and revert back to you. Thank you.

1 Like

Hey @Anil_G I think this thing will run the normal commands but not the one which need an admin rights.