It won't actually create the link yet, it just initializes the object.įrom there we set TargetPath to the target executable we want to run when the user clicks on it, you can also set other properties like Arguments, WorkingDirectory, IconLocation, and so on. The path we specify is the path where we want to create the link at. $shortcut.TargetPath = "C:\Windows\System32\cmd.exe"įirst off we create a WScript.Shell object, next we create the link object using the CreateShortcut method. $shortcut = $shell.CreateShortcut("C:\temp\shortcut.lnk") You still need to use the Shell object to manage shortcuts but it can be quite simple in PowerShell $shell = New-Object -ComObject WScript.Shell
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |