gpt4 book ai didi

powershell - 在日文机器上发出运行powershell脚本,\变成¥

转载 作者:行者123 更新时间:2023-12-03 00:08:30 28 4
gpt4 key购买 nike

鉴于我对PowerShell的了解仍在开发中,请与我一起提出任何建议/答案。

因此,在我工作的地方我们工作的公司拥有大量日文机器,需要注册Intune。但是,我们正在运行的脚本无法在其计算机上运行,​​从而导致\符号变成¥符号。

脚本存在问题的部分是:

New-Item -ItemType Directory -Force -Path C:\HWID\
Install-Script -Name Get-WindowsAutoPilotInfo
CD “C:\Program Files\WindowsPowerShell\Scripts\”
.\Get-WindowsAutoPilotInfo.ps1 -OutputFile C:\HWID\AutoPilotHWID.csv

因此,当然,简单的解决方案是暂时将语言设置更改为美国,但这当然与管理层的配合并不理想。

我可以在PowerShell脚本中做些什么来解决此问题并确保它按预期使用\符号?

我尝试过向我建议的解决方法,然后运行以下命令,输出结果将其转换为Unicode小数:92
PS C:\WINDOWS\system32> CD "C:$(0x005C)Program Files$(0x005C)WindowsPowerShell$(0x005C)Scripts$(0x005C)"

CD : Cannot find path 'C:\WINDOWS\system32\92Program Files92WindowsPowerShell92Scripts92' because it does not exist.
At line:1 char:1
+ CD "C:$(0x005C)Program Files$(0x005C)WindowsPowerShell$(0x005C)Script ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\WINDOWS\syst...hell92Scripts92:String) [Set-Location], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

因此,我愿意接受任何其他想法来解决此问题。

谢谢

最佳答案

解决的办法是使用正斜杠而不是反斜杠。

关于powershell - 在日文机器上发出运行powershell脚本,\变成¥,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55289211/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com