| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- # 创建桌面快捷方式脚本
- # 运行此脚本将在桌面创建GreaterWMS的启动快捷方式
- Write-Host "正在创建桌面快捷方式..." -ForegroundColor Yellow
- # 获取脚本所在目录(项目根目录)
- $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
- # 桌面路径
- $DesktopPath = [Environment]::GetFolderPath("Desktop")
- $ShortcutPath = Join-Path $DesktopPath "GreaterWMS.lnk"
- # 启动脚本路径(优先使用.bat,兼容性更好)
- $StartScript = Join-Path $ScriptDir "start_project.bat"
- # 图标路径(如果有的话,可以指定一个图标文件)
- # $IconPath = Join-Path $ScriptDir "icon.ico"
- try {
- # 创建快捷方式
- $WshShell = New-Object -ComObject WScript.Shell
- $Shortcut = $WshShell.CreateShortcut($ShortcutPath)
- $Shortcut.TargetPath = $StartScript
- $Shortcut.WorkingDirectory = $ScriptDir
- $Shortcut.Description = "GreaterWMS 仓库管理系统"
- # $Shortcut.IconLocation = $IconPath
- $Shortcut.Save()
- Write-Host "✓ 桌面快捷方式创建成功!" -ForegroundColor Green
- Write-Host " 位置: $ShortcutPath" -ForegroundColor Cyan
- Write-Host ""
- Write-Host "现在您可以在桌面双击 'GreaterWMS' 快捷方式来启动项目了!" -ForegroundColor Yellow
- } catch {
- Write-Host "✗ 创建快捷方式失败: $_" -ForegroundColor Red
- Write-Host ""
- Write-Host "请尝试以管理员身份运行此脚本,或者手动创建快捷方式:" -ForegroundColor Yellow
- Write-Host " 1. 右键点击桌面 -> 新建 -> 快捷方式" -ForegroundColor Gray
- Write-Host " 2. 输入: $StartScript" -ForegroundColor Gray
- Write-Host " 3. 命名为: GreaterWMS" -ForegroundColor Gray
- }
- Write-Host ""
- Write-Host "按任意键退出..."
- $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|