30 lines
1.3 KiB
PowerShell
30 lines
1.3 KiB
PowerShell
# 추가할 경로
|
|
$pathsToAdd = @(
|
|
"C:\Program Files (x86)\Windows Kits\10\Debuggers\x64",
|
|
"C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\srcsrv"
|
|
)
|
|
|
|
# 현재 시스템 PATH 값 가져오기
|
|
$regPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
|
|
$currentPath = (Get-ItemProperty -Path $regPath -Name Path).Path
|
|
|
|
# 중복 제거 및 새 경로 추가
|
|
foreach ($path in $pathsToAdd) {
|
|
if ($currentPath -notlike "*$path*") {
|
|
$currentPath += ";$path"
|
|
}
|
|
}
|
|
|
|
# 시스템 PATH 업데이트
|
|
Set-ItemProperty -Path $regPath -Name Path -Value $currentPath
|
|
|
|
# 환경 변수 업데이트 알림 (재부팅 없이 적용되도록)
|
|
$signature = '[DllImport("user32.dll")] public static extern int SendMessageTimeout(int hWnd, int Msg, int wParam, string lParam, int fuFlags, int uTimeout, out int lpdwResult);'
|
|
$SendMessageTimeout = Add-Type -MemberDefinition $signature -Name 'Win32SendMessageTimeout' -Namespace Win32Functions -PassThru
|
|
$HWND_BROADCAST = 0xffff
|
|
$WM_SETTINGCHANGE = 0x001A
|
|
$SMTO_ABORTIFHUNG = 0x0002
|
|
[void]$SendMessageTimeout::SendMessageTimeout($HWND_BROADCAST, $WM_SETTINGCHANGE, 0, "Environment", $SMTO_ABORTIFHUNG, 5000, [ref]0)
|
|
|
|
Write-Host "✅ Windows SDK Debugger paths have been added to the system PATH. No reboot required!"
|