Create a shell link (shortcut)

Enable run at startup

$target = "C:\Windows\system32\notepad.exe"
$shortcutName = "example.lnk"
 
$env:Startup = (New-Object -ComObject Shell.Application).NameSpace('shell:Startup').Self.Path
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$env:Startup\$shortcutName")
$Shortcut.TargetPath = $target
$Shortcut.Save()

Create a shortcut in Startup

$env:Startup = (New-Object -ComObject Shell.Application).NameSpace('shell:Startup').Self.Path
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$env:Startup\example.lnk")
$Shortcut.TargetPath = "powershell.exe"
$Shortcut.WorkingDirectory = $env:TEMP
$Shortcut.Arguments = '-NoExit -Command "date"'
$Shortcut.IconLocation = "$env:SystemRoot\System32\notepad.exe"
$Shortcut.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Maximized
$Shortcut.Hotkey = "ALT+CTRL+F"
$Shortcut.Description = "Hover tooltip"
$Shortcut.Save()

Symbolic links

Create a symbolic link

New-Item -ItemType SymbolicLink `
    -Name <# Filename or Foldername #> `
    -Target <# Target Path #>

Create a hard link

New-Item -ItemType HardLink `
    -Name <# Filename #> `
    -Target <# Target Path #>

Create a junction

New-Item -ItemType Junction `
    -Name <# Folder name #> `
    -Target <# Target Path #>

Sources:

Related:

Tags:
File System - Use paths, get meta data, link, download, and encrypt files and folders