使用 PowerShell 脚本将内容复制到文件时添加方块字符:
$PSscript = @"
New-PSDrive -Name $driveLetter -Root $drivePath -Persist -PSProvider "FileSystem" -Scope Global
"@
# Add code to the script
Set-Content -Path "$scriptPath\$scriptName" -Value $PSscript -Encoding UTF8
尝试添加内容、设置内容、>、Out-File - 同样的问题