가장 좋은 방법은 다음 방법이라고 생각합니다 (powershell 사용).이 방법으로도 1024 문자의 소동을 피하십시오.
https://gist.github.com/drazul/b92f780689bd89a0d2a7 에서 코드를 볼 수 있습니다.
#------------ Add path to system variable -------------------------------------
$path2add = ';C:\path;'
$systemPath = [Environment]::GetEnvironmentVariable('Path', 'machine');
If (!$systemPath.contains($path2add)) {
$systemPath += $path2add
$systemPath = $systemPath -join ';'
[Environment]::SetEnvironmentVariable('Path', $systemPath, 'Machine');
write-host "Added to path!"
write-host $systemPath
}
#------------ Delete path from system variable --------------------------------
$path2delete = 'C:\path;'
$systemPath = [Environment]::GetEnvironmentVariable('Path', 'machine');
$systemPath = $systemPath.replace($path2delete, '')
$systemPath = $systemPath -join ';'
[Environment]::SetEnvironmentVariable('Path', $systemPath, 'Machine');
write-host "Deleted from path!"
write-host $systemPath
#------------ Clean system variable -------------------------------------------
$systemPath = [Environment]::GetEnvironmentVariable('Path', 'machine');
while ($systemPath.contains(';;')) {
$systemPath = $systemPath.replace(';;', ';')
}
[Environment]::SetEnvironmentVariable('Path', $systemPath, 'Machine');
write-host "Cleaned path!"
write-host $systemPath
%PATH%
에 superuser.com/questions/297947은