I want to create a shortcut with PowerShell for this executable:
C:\Program Files (x86)\ColorPix\ColorPix.exe
How can this be done?
I want to create a shortcut with PowerShell for this executable:
C:\Program Files (x86)\ColorPix\ColorPix.exe
How can this be done?
I don't know any native cmdlet in powershell but you can use com object instead:
you can create a powershell script save as set-shortcut.ps1 in your $pwd
and call it like this
Set-ShortCut "C:\Program Files (x86)\ColorPix\ColorPix.exe" "$Home\Desktop\ColorPix.lnk"
If you want to pass arguments to the target exe, it can be done by:
before $Shortcut.Save().
For convenience, here is a modified version of set-shortcut.ps1. It accepts arguments as its second parameter.
Beginning PowerShell 5.0
New-Item
,Remove-Item
, andGet-ChildItem
have been enhanced to support creating and managing symbolic links. The ItemType parameter forNew-Item
accepts a new value, SymbolicLink. Now you can create symbolic links in a single line by running the New-Item cmdlet.Be Carefull a SymbolicLink is different from a Shortcut, shortcuts are just a file. They have a size (A small one, that just references where they point) and they require an application to support that filetype in order to be used. A symbolic link is filesystem level, and everything sees it as the original file. An application needs no special support to use a symbolic link.
Anyway if you want to create a Run As Administrator shortcut using Powershell you can use
If anybody want to change something else in a .LNK file you can refer to official Microsoft documentation.