0

Very simple code:

$bytes = [System.IO.File]::ReadAllBytes("$env:APPDATA\Microsoft\Windows\Start Menu\Programs\System Tools\Command Prompt.lnk")
$bytes[0x15] = $bytes[0x15] -bor 0x20
[System.IO.File]::WriteAllBytes("$env:APPDATA\Microsoft\Windows\Start Menu\Programs\System Tools\Command Prompt.lnk", $bytes)

It makes the shortcut to be run as Administrator. I look through some examples in stackoverflow, but nothing works. And I'd like to write it not in a single line.

farag
  • 325
  • 1
  • 4
  • 20

1 Answers1

0
@findstr /v "^@f.*&" "%~f0" | powershell -&goto eof
$bytes = [System.IO.File]::ReadAllBytes("$env:APPDATA\Microsoft\Windows\Start Menu\Programs\System Tools\Command Prompt.lnk")
$bytes[0x15] = $bytes[0x15] -bor 0x20
[System.IO.File]::WriteAllBytes("$env:APPDATA\Microsoft\Windows\Start Menu\Programs\System Tools\Command Prompt.lnk", $bytes)
farag
  • 325
  • 1
  • 4
  • 20