gpt-4o-2024-08-06· OpenAI
WildChat-4.8M (AI2)
using windows powershell to create a shortcut of Discord.exe, please modify this part of…
- User
using windows powershell to create a shortcut of Discord.exe, please modify this part of script: REM Find the latest Discord app directory for /d %%a in ("%baseDir%\app-*") do set "latestAppDir=%%a"
if defined latestAppDir ( echo Opening latest Discord directory: "%latestAppDir%" explorer "%latestAppDir%"
REM Create a shortcut on the desktop set "shortcutName=Discord.lnk" set "targetPath=%latestAppDir%\Discord.exe")
- Assistant
To create a shortcut for the
Discord.exeapplication using PowerShell, you can replace the batch script portion with PowerShell cmdlets. Here is a full script using PowerShell to achieve this:# Define the base directory where Discord is installed $baseDir = "C:\Path\To\Discord" # Modify this to your actual Discord installation path # Find the latest Discord app directory $latestAppDir = Get-ChildItem -Path $baseDir -Directory | Sort-Object LastWriteTime -Descending | Select-Object -First 1 if ($latestAppDir) { Write-Host "Opening latest Discord directory: $($latestAppDir.FullName)" # Define the shortcut name and target path $shortcutName = "Discord.lnk" $targetPath = Join-Path -Path $latestAppDir.FullName -ChildPath "Discord.exe" # Define where to place the shortcut, typically on the Desktop $desktopPath = [System.Environment]::GetFolderPath('Desktop') $shortcutFilePath = Join-Path -Path $desktopPath -ChildPath $shortcutName # Create a new WScript.Shell COM object $shell = New-Object -ComObject WScript.Shell # Create the shortcut $shortcut = $shell.CreateShortcut($shortcutFilePath) $shortcut.TargetPath = $targetPath $shortcut.Save() Write-Host "Shortcut created on Desktop: $shortcutFilePath" } else { Write-Host "No Discord directory found in $baseDir" }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.