Create a Windows shortcut.
New-Shortcut.ps1 [-Path] <String> [-TargetPath] <String> [[-Arguments] <String>] [[-WorkingDirectory] <String>]
[-Description <String>] [-Hotkey <String>] [-IconLocation <String>] [-WindowStyle <String>]
[-RunAsAdministrator] [-ProgressAction <ActionPreference>] [<CommonParameters>]
New-Shortcut -Path "$Home\Desktop\Explorer.lnk" -TargetPath '%SystemRoot%\explorer.exe' -RunAsAdministrator
Creates an Explorer shortcut on the desktop that runs as admin.
Type: String
Parameter Sets: (All)
Aliases: Name
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The path of the file the shortcut will point to.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Any command-line parameters to pass to the TargetPath, if it is a program.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The folder to run TargetPath in.
Type: String
Parameter Sets: (All)
Aliases: StartIn
Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Some descriptive text for the shortcut.
Type: String
Parameter Sets: (All)
Aliases: Comment
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
A Windows Explorer key combination to open the shortcut, usually starting with “Ctrl + Alt +”.
Type: String
Parameter Sets: (All)
Aliases: ShortcutKey
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The path to a file with an icon to use, and an index, e.g.
%SystemRoot%\system32\SHELL32.dll,244
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The state the window should start in: Normal, Maximized, or Minimized.
Type: String
Parameter Sets: (All)
Aliases: Run
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Indicates the shortcut should invoke UAC and run as an admin.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: Admin
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.