Last active
January 23, 2019 01:03
-
-
Save kpatnayakuni/395dda9fabcdd5170a1a01aedce5e5b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enter your ps script name including path | |
# And launch application to the script file at the end of the code | |
# Start-Process -FilePath <yourapplication.exe> | |
$ScriptFile = 'yourpsfileincludingpath.ps1' | |
$ShortcutFile = "$Home\Desktop\" + (Get-ChildItem -Path $ScriptFile).BaseName + '.lnk' | |
$PowerShellPath = "$env:SystemRoot\system32\WindowsPowerShell\v1.0\powershell.exe" | |
$WshShell = New-Object -comObject WScript.Shell | |
$Shortcut = $WshShell.CreateShortcut($ShortcutFile) | |
$Shortcut.TargetPath = $PowerShellPath | |
$Shortcut.Arguments = "-File $ScriptFile" | |
$Shortcut.Save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment