diff --git a/setup/setup_windows.ps1 b/setup/setup_windows.ps1 index d8e0ee0..549c511 100644 --- a/setup/setup_windows.ps1 +++ b/setup/setup_windows.ps1 @@ -129,8 +129,28 @@ if ($CreateShortcuts) { Write-Host "" Write-Host "=== 부서별 바탕화면 바로가기 생성 ===" - # claude.exe 경로 자동 탐색 - if (-not $ClaudeExePath) { + # 1) MSIX/Store 패키지 우선 탐지 (PD님 환경 표준) + $msixPkg = $null + try { $msixPkg = Get-AppxPackage -Name '*Claude*' -ErrorAction SilentlyContinue | Select-Object -First 1 } catch {} + + $msixLaunchArg = $null + if ($msixPkg) { + # AppxManifest에서 AppId 추출 + $manifestPath = Join-Path $msixPkg.InstallLocation 'AppxManifest.xml' + $appId = 'App' + if (Test-Path $manifestPath) { + try { + [xml]$m = Get-Content $manifestPath + $appIdNode = $m.Package.Applications.Application | Select-Object -First 1 + if ($appIdNode -and $appIdNode.Id) { $appId = $appIdNode.Id } + } catch {} + } + $msixLaunchArg = "shell:AppsFolder\$($msixPkg.PackageFamilyName)!$appId" + Write-Host "Claude MSIX 패키지 탐지: $($msixPkg.PackageFamilyName) / AppId=$appId" + } + + # 2) MSIX 미탐지 시 일반 claude.exe 탐색 (fallback) + if (-not $msixLaunchArg -and -not $ClaudeExePath) { $candidatePaths = @( "$env:LOCALAPPDATA\Programs\claude\claude.exe", "$env:LOCALAPPDATA\AnthropicClaude\claude.exe", @@ -140,25 +160,17 @@ if ($CreateShortcuts) { "$env:LOCALAPPDATA\Programs\Claude\Claude.exe" ) foreach ($cp in $candidatePaths) { - if (Test-Path $cp) { - $ClaudeExePath = $cp - Write-Host "claude.exe 자동 탐지: $ClaudeExePath" - break - } + if (Test-Path $cp) { $ClaudeExePath = $cp; Write-Host "claude.exe 자동 탐지: $ClaudeExePath"; break } } if (-not $ClaudeExePath) { $where = (Get-Command claude.exe -ErrorAction SilentlyContinue).Source - if ($where) { - $ClaudeExePath = $where - Write-Host "claude.exe PATH에서 탐지: $ClaudeExePath" - } + if ($where) { $ClaudeExePath = $where; Write-Host "claude.exe PATH에서 탐지: $ClaudeExePath" } } } - if (-not $ClaudeExePath -or -not (Test-Path $ClaudeExePath)) { - Write-Warning "claude.exe 경로 탐지 실패. 바로가기 생성 생략." + if (-not $msixLaunchArg -and (-not $ClaudeExePath -or -not (Test-Path $ClaudeExePath))) { + Write-Warning "Claude 실행 수단 탐지 실패 (MSIX·exe 모두). 바로가기 생성 생략." Write-Warning "수동 지정: .\setup_windows.ps1 -CreateShortcuts -ClaudeExePath '<실제 경로>'" - Write-Warning "claude.exe 위치 확인법: Claude Code 앱 실행 파일 속성 > 대상 경로 복사" } else { $WshShell = New-Object -ComObject WScript.Shell $desktop = [Environment]::GetFolderPath("Desktop") @@ -176,16 +188,28 @@ if ($CreateShortcuts) { } $shortcutPath = Join-Path $desktop "$($t.Name).lnk" $sc = $WshShell.CreateShortcut($shortcutPath) - $sc.TargetPath = $ClaudeExePath + if ($msixLaunchArg) { + # MSIX 앱: explorer.exe shell:AppsFolder\... 방식 + $sc.TargetPath = "explorer.exe" + $sc.Arguments = $msixLaunchArg + } else { + # 일반 exe 방식 + $sc.TargetPath = $ClaudeExePath + $sc.IconLocation = "$ClaudeExePath,0" + } $sc.WorkingDirectory = $t.Dir - $sc.IconLocation = "$ClaudeExePath,0" $sc.Description = $t.Desc $sc.Save() Write-Host "바로가기 생성: $shortcutPath (WD=$($t.Dir))" } Write-Host "" - Write-Host "바로가기 3종 생성 완료. 바탕화면에서 각 바로가기 더블클릭으로 해당 부서 폴더에서 Claude Code 실행 가능." + if ($msixLaunchArg) { + Write-Host "바로가기 3종 생성 완료 (MSIX 모드)." + Write-Host "※ MSIX 앱은 WorkingDirectory가 전달되지 않을 수 있음. 바로가기 더블클릭 후 실제 프로젝트 경로 확인 필수." + } else { + Write-Host "바로가기 3종 생성 완료." + } } }