我有以下用于Powershell x64的代码。长话短说,我正在等待修复的x64配置文件有问题(我没有管理员权限来修复;单独的问题)。
其中包含了前五行代码,以强制Powershell 32位运行,并且确实可以运行。我的问题是,由于某种原因,在成功使用32位.exe运行之后,该代码再次使用64位.exe运行,这当然会引发与配置文件问题有关的各种错误。 / p>
除了错误之外,是否有任何明显的代码段导致从第7行到第二行的所有代码再次运行?我会尽力提供您可能需要的更多信息来帮助我解决此问题。
注意:从第7行开始的整个代码集都可以正常工作,因此除了修复此循环外,无需进行任何更改。
Streams.print(Modelica.Math.Vector.toString(resultVector),"filename");
答案 0 :(得分:1)
问题在这里
if ($env:Processor_Architecture -ne "x86")
{ &"$env:windir\syswow64\windowspowershell\v1.0\powershell.exe" -noprofile -file $myinvocation.Mycommand.path }
当您在Powershell x64中运行此脚本时,您所要做的就是启动x86 Powershell,但没有终止x64,因此x64继续运行脚本。
添加退出类似
if ($env:Processor_Architecture -ne "x86"){
&"$env:windir\syswow64\windowspowershell\v1.0\powershell.exe" -noprofile -file $myinvocation.Mycommand.path
exit
}