LoginSignup
5

More than 5 years have passed since last update.

コマンドライン(バッチファイル)から明示的に UAC 昇格する一番短い方法

Last updated at Posted at 2015-09-07

今まで VB.Net で書いたり、バッチファイル+JScript を書いたり、いろいろ考えてきたけど、PowerShell ならワンライナーで出来たー

powershell "$obj=New-Object -Com Shell.Application ; $obj.ShellExecute('cmd.exe','/k dir','','runas')"

なお、これは COM を使っているんだけど、本来は .NET 方面のオブジェクトを使った方がいいんでしょうね

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5