scripts

New-Shortcut.ps1

SYNOPSIS

Create a Windows shortcut.

SYNTAX

New-Shortcut.ps1 [-Path] <String> [-TargetPath] <String> [[-Arguments] <String>] [[-WorkingDirectory] <String>]
 [-Description <String>] [-Hotkey <String>] [-IconLocation <String>] [-WindowStyle <String>]
 [-RunAsAdministrator] [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

EXAMPLES

EXAMPLE 1

New-Shortcut -Path "$Home\Desktop\Explorer.lnk" -TargetPath '%SystemRoot%\explorer.exe' -RunAsAdministrator

Creates an Explorer shortcut on the desktop that runs as admin.

PARAMETERS

-Path

Type: String
Parameter Sets: (All)
Aliases: Name

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-TargetPath

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

-Arguments

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

-WorkingDirectory

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

-Description

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

-Hotkey

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

-IconLocation

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

-WindowStyle

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

-RunAsAdministrator

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

-ProgressAction

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Void

NOTES

https://ss64.com/vb/shortcut.html