File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 22$OutputEncoding = [System.Text.Encoding ]::UTF8
33[Console ]::OutputEncoding = [System.Text.Encoding ]::UTF8
44
5- # 颜色定义
6- $RED = " `e [31m"
7- $GREEN = " `e [32m"
8- $YELLOW = " `e [33m"
9- $BLUE = " `e [34m"
10- $NC = " `e [0m"
5+ # 颜色定义(兼容 PowerShell 5.1 和 7.x)
6+ $ESC = [char ]27
7+ $RED = " $ESC [31m"
8+ $GREEN = " $ESC [32m"
9+ $YELLOW = " $ESC [33m"
10+ $BLUE = " $ESC [34m"
11+ $NC = " $ESC [0m"
1112
1213# 路径解析:优先使用 .NET 获取系统目录,避免环境变量缺失导致路径异常
1314function Get-FolderPathSafe {
@@ -36,7 +37,7 @@ function Get-FolderPathSafe {
3637 if ([string ]::IsNullOrWhiteSpace($path )) {
3738 Write-Host " $YELLOW ⚠️ [路径]$NC $Label 无法解析,将尝试其他方式"
3839 } else {
39- Write-Host " $BLUEℹ ️ [路径]$NC $Label : $path "
40+ Write-Host " $BLUEℹ ️ [路径]$NC ${ Label} : $path "
4041 }
4142 return $path
4243}
You can’t perform that action at this time.
0 commit comments