Super User Asked on January 1, 2022
In Windows I can set up a shortcut to run application always as administrator:
I need to create such shortcut from the command line. How can I do that?
try with shortcutJS.bat - it can create a shortcut with "run as admin" tick from command line :
call shortcutJS.bat -linkfile "some.lnk" -target "%cd%some.bat" -adminpermissions yes
this also changes 21st byte of the file. More information can be found somewhere in this docs.
Answered by npocmaka on January 1, 2022
A StackOverflow answer shows how to accomplish this in Powershell. There's no easy interface to add the Run as administrator
flag, so it involves flipping a bit in the .LNK
binary file.
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$HomeDesktop7-Zip File Manager.lnk")
$Shortcut.TargetPath = "C:Program Files7-Zip7zFM.exe"
$Shortcut.Save()
$bytes = [System.IO.File]::ReadAllBytes("$HomeDesktop7-Zip File Manager.lnk")
$bytes[0x15] = $bytes[0x15] -bor 0x20 #set byte 21 (0x15) bit 6 (0x20) ON
[System.IO.File]::WriteAllBytes("$HomeDesktop7-Zip File Manager.lnk", $bytes)
Answered by davidmneedham on January 1, 2022
0 Asked on February 14, 2021
1 Asked on February 14, 2021 by sivaram-t
0 Asked on February 14, 2021 by grigera
1 Asked on February 13, 2021 by alrob
1 Asked on February 13, 2021 by x-x
1 Asked on February 13, 2021 by scitty
3 Asked on February 13, 2021 by suku-k
chrome remote desktop clipboard google chrome remote desktop
3 Asked on February 13, 2021
1 Asked on February 12, 2021 by gxlg
1 Asked on February 12, 2021 by pedro77
4 Asked on February 12, 2021 by monstieur
0 Asked on February 12, 2021 by kcfnmi
0 Asked on February 11, 2021 by avarf
2 Asked on February 11, 2021 by thatdataguy
0 Asked on February 11, 2021 by codeforfun
0 Asked on February 11, 2021 by guilherme-taffarel-bergamin
0 Asked on February 10, 2021 by anca
Get help from others!
Recent Questions
Recent Answers
© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir