我有powershell脚本,我想向文件中写入一些数据。如果我在powershell下运行脚本,则文件将正确写入。但是当我在winPE下执行时,文件看起来很奇怪。像这样
;********** ATF Output **********
㬀䈀甀椀氀搀开䤀䐀㴀㠀圀圀儀㘀䈀吀㘀 ㈀⌀匀䄀䈀䌀⌀䐀䄀䈀䌀ഀഀ
;Feature_Byte=3E3X476J6S6b7B7H7M7Q7T7W7maBapaqaubhcAdUdpdqgzhKhZjh.ma
㬀䴀䰀开倀爀攀昀椀砀㴀䐀倀䌀ഀഀ
;CRM=A1
㬀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀⨀ഀഀ
这是我如何编写文件的powershell脚本。
$Outer = ";***********************************"
$Header = ";********** ATF Output **********"
$ML = $Global:SelectedFile_Name.Substring(0,11)
$FB = ";Feature_Byte=3E3X476J6S6b7B7H7M7Q7T7W7maBapaqaubhcAdUdpdqgzhKhZjh.ma"
# Prefix selection
if ($NB.Checked -eq $true) {$Prefix = ";ML_Prefix=" + "BNB"}
if ($DPC.Checked -eq $true) {$Prefix = ";ML_Prefix=" + "DPC"}
# Creating SWPO
Write-Host "Starting Creating SWPOs...."
$count = 1
Foreach ($key in $ini_file.($section).Keys)
{
try
{
$B_ID = ";Build_ID=" + $ML + "#" + "S" + $ini_file.($section)["$key"].Substring(0, 3) + "#" + "D" + $ini_file.($section)["$key"].Substring(0, 3)
$CRM = ";CRM=$key"
$Output_SWPO = $Header, $B_ID, $FB, $Prefix, $CRM, $Outer | Out-File $store\$ML`_$key -Force
期望文件应该是这样
;********** ATF Output **********
;Build_ID=18WWQ6BT602#SABC#DABC
;Feature_Byte=3E3X476J6S6b7B7H7M7Q7T7W7maBapaqaubhcAdUdpdqgzhKhZjh.ma
;ML_Prefix=DPC
;CRM=A1
;***********************************