while running certain command in windows powershell, it returned with a message " Access denied. Option -c requires administrative privileges.", so in linux (ubuntu) we use 'sudo' right, but how should I do it in windows.
Asked
Active
Viewed 482 times
0
-
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Feb 05 '22 at 14:06
1 Answers
0
This code will require admin rights if the batch is not started as admin:
net session >nul 2>&1 || (powershell start -verb runas '"%~0"' &exit /b)
Ricardo Bohner
- 3,903
- 2
- 18
- 12