# Cree un raccourci Windows pour lancer l'application sans fenetre de console. # # Usage : clic droit sur ce fichier > "Executer avec PowerShell" # ou : powershell -ExecutionPolicy Bypass -File tools\create_shortcut.ps1 # # Options : # -Desktop place aussi une copie sur le Bureau # -StartMenu place aussi une copie dans le menu Demarrer param( [switch]$Desktop, [switch]$StartMenu ) $root = Split-Path -Parent $PSScriptRoot $target = Join-Path $root "venv\Scripts\pythonw.exe" # pythonw = pas de console noire $script = Join-Path $root "main.py" $icon = Join-Path $root "resources\app.ico" if (-not (Test-Path $target)) { Write-Host "Environnement virtuel introuvable. Lancez d'abord setup.bat." -ForegroundColor Red exit 1 } if (-not (Test-Path $icon)) { # l'icone se regenere depuis l'application elle-meme & (Join-Path $root "venv\Scripts\python.exe") (Join-Path $root "tools\make_icon.py") } $shell = New-Object -ComObject WScript.Shell function New-AppShortcut([string]$path) { $lnk = $shell.CreateShortcut($path) $lnk.TargetPath = $target $lnk.Arguments = '"' + $script + '"' $lnk.WorkingDirectory = $root $lnk.IconLocation = $icon $lnk.Description = "Client SSH/SFTP personnel" $lnk.Save() Write-Host "Raccourci cree : $path" -ForegroundColor Green } New-AppShortcut (Join-Path $root "PySSH Client.lnk") if ($Desktop) { New-AppShortcut (Join-Path ([Environment]::GetFolderPath("Desktop")) "PySSH Client.lnk") } if ($StartMenu) { $programs = Join-Path ([Environment]::GetFolderPath("StartMenu")) "Programs" New-AppShortcut (Join-Path $programs "PySSH Client.lnk") }