Install-ChocolateyShortcut
Install-ChocolateyShortcut
Install-ChocolateyShortcut
Creates a shortcut
Syntax
Install-ChocolateyShortcut `
-ShortcutFilePath <String> `
-TargetPath <String> `
[-WorkingDirectory <String>] `
[-Arguments <String>] `
[-IconLocation <String>] `
[-Description <String>] `
[-WindowStyle <Int32>] `
[-RunAsAdmin] `
[-PinToTaskbar] `
[-IgnoredArguments <Object[]>] [<CommonParameters>]
Description
This adds a shortcut, at the specified location, with the option to specify a number of additional properties for the shortcut, such as Working Directory, Arguments, Icon Location, and Description.
Notes
If this errors, as it may if being run under the local SYSTEM account with particular folder that SYSTEM doesn’t have, it will display a warning instead of failing a package installation.
Aliases
None
Examples
EXAMPLE 1
# This will create a new shortcut at the location of "C:\test.lnk" and
# link to the file located at "C:\text.exe"
Install-ChocolateyShortcut -ShortcutFilePath "C:\test.lnk" -TargetPath "C:\test.exe"
EXAMPLE 2
# This will create a new shortcut at the location of "C:\notepad.lnk"
# and link to the Notepad application. In addition, other properties
# are being set to specify the working directory, an icon to be used for
# the shortcut, along with a description and arguments.
Install-ChocolateyShortcut `
-ShortcutFilePath "C:\notepad.lnk" `
-TargetPath "C:\Windows\System32\notepad.exe" `
-WorkingDirectory "C:\" `
-Arguments "C:\test.txt" `
-IconLocation "C:\test.ico" `
-Description "This is the description"
EXAMPLE 3
# Creates a new notepad shortcut on the root of c: that starts
# notepad.exe as Administrator. Shortcut is also pinned to taskbar.
Install-ChocolateyShortcut `
-ShortcutFilePath "C:\notepad.lnk" `
-TargetPath "C:\Windows\System32\notepad.exe" `
-WindowStyle 3 `
-RunAsAdmin `
-PinToTaskbar
Inputs
None
Outputs
None
Parameters
-ShortcutFilePath <String>
Property | Value |
---|---|
Aliases | |
Required? | true |
Position? | 1 |
Default Value | |
Accept Pipeline Input? | false |
-TargetPath <String>
Property | Value |
---|---|
Aliases | |
Required? | true |
Position? | 2 |
Default Value | |
Accept Pipeline Input? | false |
-WorkingDirectory [<String>]
Property | Value |
---|---|
Aliases | |
Required? | false |
Position? | 3 |
Default Value | |
Accept Pipeline Input? | false |
-Arguments [<String>]
Property | Value |
---|---|
Aliases | |
Required? | false |
Position? | 4 |
Default Value | |
Accept Pipeline Input? | false |
-IconLocation [<String>]
Property | Value |
---|---|
Aliases | |
Required? | false |
Position? | 5 |
Default Value | |
Accept Pipeline Input? | false |
-Description [<String>]
Property | Value |
---|---|
Aliases | |
Required? | false |
Position? | 6 |
Default Value | |
Accept Pipeline Input? | false |
-WindowStyle [<Int32>]
Property | Value |
---|---|
Aliases | |
Required? | false |
Position? | 7 |
Default Value | 0 |
Accept Pipeline Input? | false |
-RunAsAdmin
Property | Value |
---|---|
Aliases | |
Required? | false |
Position? | named |
Default Value | False |
Accept Pipeline Input? | false |
-PinToTaskbar
Property | Value |
---|---|
Aliases | |
Required? | false |
Position? | named |
Default Value | False |
Accept Pipeline Input? | false |
-IgnoredArguments [<Object[]>]
Property | Value |
---|---|
Aliases | |
Required? | false |
Position? | named |
Default Value | |
Accept Pipeline Input? | false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters
http://go.microsoft.com/fwlink/p/?LinkID=113216 .
Links
Function Reference:choco-info: NOTE
This documentation has been automatically generated from
Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" -Force; Get-Help Install-ChocolateyShortcut -Full
.
View the source for Install-ChocolateyShortcut