PowerShell create shortcut on desktop with arguments Mới nhất
Kinh Nghiệm về PowerShell create shortcut on desktop with arguments Mới Nhất
Bạn đang tìm kiếm từ khóa PowerShell create shortcut on desktop with arguments được Update vào lúc : 2022-12-06 11:25:06 . Với phương châm chia sẻ Thủ Thuật Hướng dẫn trong nội dung bài viết một cách Chi Tiết 2022. Nếu sau khi tìm hiểu thêm tài liệu vẫn ko hiểu thì hoàn toàn có thể lại Comment ở cuối bài để Admin lý giải và hướng dẫn lại nha.
Create Shortcuts .lnk or .url Files With PowerShell
by · Published January 22, 2022 · Updated March 7, 2022
Have you ever needed to create shortcuts while scripting. Shortcuts are simply .lnk files with a few details highlighting a few details of the file that you would like to launch. Many people simply copy an already created shortcut. With PowerShell you can actually create a shortcut from scratch by utilizing the New-Object commandlet. Here is the quick run down with explanation.
Step #1: The first step is to create a variable referencing a Wscript.Shell COM Object.
$Shell = New-Object -ComObject (“WScript.Shell”)
Step #2: The second step is to define the location and name of your shortcut. The following example will add the shortcut to the users desktop with a name of Your Shortcut.
$Shell = New-Object -ComObject (“WScript.Shell”)
$ShortCut = $Shell.CreateShortcut($env:USERPROFILE + “DesktopYour Shortcut.lnk”)
Step #3: The third step is to add the target path, any relevant arguments, along with anything else that may be required.
$Shell = New-Object -ComObject (“WScript.Shell”)
$ShortCut = $Shell.CreateShortcut($env:USERPROFILE + “DesktopYour Shortcut.lnk”)
$ShortCut.TargetPath=”yourexecutable.exe”
$ShortCut.Arguments=”-arguementsifrequired”
$ShortCut.WorkingDirectory = “c:yourexecutablethư mụcpath”;
$ShortCut.WindowStyle = 1;
$ShortCut.Hotkey = “CTRL+SHIFT+F”;
$ShortCut.IconLocation = “yourexecutable.exe, 0”;
$ShortCut.Description = “Your Custom Shortcut Description”;
Step #4: The final step is to envoke the Save() method to save your shortcut.
$Shell = New-Object -ComObject (“WScript.Shell”)
$ShortCut = $Shell.CreateShortcut($env:USERPROFILE + “DesktopYour Shortcut.lnk”)
$ShortCut.TargetPath=”yourexecutable.exe”
$ShortCut.Arguments=”-arguementsifrequired”
$ShortCut.WorkingDirectory = “c:yourexecutablethư mụcpath”;
$ShortCut.WindowStyle = 1;
$ShortCut.Hotkey = “CTRL+SHIFT+F”;
$ShortCut.IconLocation = “yourexecutable.exe, 0”;
$ShortCut.Description = “Your Custom Shortcut Description”;
$ShortCut.Save()
Step #5: As a bonus here is how you would create a Favorite in Windows which is a .url shortcut.
$Shell = New-Object -ComObject (“WScript.Shell”)
$Favorite = $Shell.CreateShortcut($env:USERPROFILE + “DesktopYour Shortcut.url”)
$Favorite.TargetPath = “http://www.yoururl.com”;
$Favorite.Save()
Share Link Tải PowerShell create shortcut on desktop with arguments miễn phí
Bạn vừa đọc tài liệu Với Một số hướng dẫn một cách rõ ràng hơn về Video PowerShell create shortcut on desktop with arguments tiên tiến và phát triển nhất và Share Link Down PowerShell create shortcut on desktop with arguments miễn phí.
Hỏi đáp vướng mắc về PowerShell create shortcut on desktop with arguments
Nếu sau khi đọc nội dung bài viết PowerShell create shortcut on desktop with arguments vẫn chưa hiểu thì hoàn toàn có thể lại Comment ở cuối bài để Ad lý giải và hướng dẫn lại nha
#PowerShell #create #shortcut #desktop #arguments