Is this possible?
I've just been trying something simple:
Start-Process -FilePath "C:\Windows\System32\cmd.exe" -verb runas -ArgumentList {echo hello1}
CMD starts in admin, but nothing happens after that.
The long story is, when I want to use "Remove-Item" I do not want to use the -Recurse argument because it will throw access denied errors for various reasons. The only way I know how to do it without any prompts is using rmdir inside a command prompt window.
Does anyone know a way to either suppress the prompt without -recurse or how I could start CMD and call rmdir with all its parameters?
You pretty much have the whole thing. Just add a /c
or /k
at the beginning of your argument list.
/c
- close command prompt after i run my command/k
- keep command prompt open
Start-Process -FilePath "C:\Windows\System32\cmd.exe" -verb runas -ArgumentList {/c echo hello1}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With