can you make it so the script ends without any loop: powershell -Command ^ "$WshShell =…
- User
can you make it so the script ends without any loop: powershell -Command ^ "WshShell = New-Object -ComObject WScript.Shell; ^ desktopPath = [System.Environment]::GetFolderPath('Desktop'); ^ WshShell.CreateShortcut("desktopPath\\Discord.lnk\"); ^ Shortcut.TargetPath = "%DISCORD_PATH%"; ^ $Shortcut.Save()"
echo. echo Discord Debloat Completed. echo. pause
- Assistant
Certainly! The script you've provided creates a shortcut for Discord on the desktop and then displays a completion message. Since there's no loop in the script itself, it ends naturally once all commands are executed. However, if you want to ensure the script ends cleanly after the messages are displayed, here’s how you can structure it:
powershell# PowerShell command to create a shortcut on the desktop powershell -Command ^ "$WshShell = New-Object -ComObject WScript.Shell; ^ $desktopPath = [System.Environment]::GetFolderPath('Desktop'); ^ $Shortcut = $WshShell.CreateShortcut(\"$desktopPath\\Discord.lnk\"); ^ $Shortcut.TargetPath = \"%DISCORD_PATH%\"; ^ $Shortcut.Save()" # Notify the user that the process is complete echo. echo Discord Debloat Completed. echo. pause # End the script exitThis script runs a PowerShell command to create a desktop shortcut, then prints out completion messages, pauses for user input, and finally exits. The command at the end ensures that the script terminates cleanly.