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>

PropertyValue
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false

-TargetPath <String>

PropertyValue
Aliases
Required?true
Position?2
Default Value
Accept Pipeline Input?false

-WorkingDirectory [<String>]

PropertyValue
Aliases
Required?false
Position?3
Default Value
Accept Pipeline Input?false

-Arguments [<String>]

PropertyValue
Aliases
Required?false
Position?4
Default Value
Accept Pipeline Input?false

-IconLocation [<String>]

PropertyValue
Aliases
Required?false
Position?5
Default Value
Accept Pipeline Input?false

-Description [<String>]

PropertyValue
Aliases
Required?false
Position?6
Default Value
Accept Pipeline Input?false

-WindowStyle [<Int32>]

PropertyValue
Aliases
Required?false
Position?7
Default Value0
Accept Pipeline Input?false

-RunAsAdmin

PropertyValue
Aliases
Required?false
Position?named
Default ValueFalse
Accept Pipeline Input?false

-PinToTaskbar

PropertyValue
Aliases
Required?false
Position?named
Default ValueFalse
Accept Pipeline Input?false

-IgnoredArguments [<Object[]>]

PropertyValue
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 .

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