确定是否当前PowerShell进程是32位还是64位? [英] Determine if current PowerShell Process is 32-bit or 64-bit?

查看:1063
本文介绍了确定是否当前PowerShell进程是32位还是64位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在上一个64位操作系统平台上运行PowerShell脚本,你怎么能确定的脚本的是什么版本的PowerShell(32位或64位)的脚本运行?

When running a PowerShell script on a x64-bit OS platform, how can you determine in the script what version of PowerShell (32-bit or 64-bit) the script is running on?

背景
(即使用64位的32位和64位版本的PowerShell默认情况下在64位平台,如Windows Server 2008。这可能会导致困难的时候PowerShell脚本是RAN必须针对特定的建筑安装为SharePoint 2010中的脚本,以消耗的64位库)。

Background
Both 32-bit and 64-bit versions of PowerShell are installed by default on a 64-bit platform such as Windows Server 2008. This can lead to difficulties when a PowerShell script is ran that must target a specific architecture (i.e. using 64-bit for a script for SharePoint 2010, in order to consume the 64-bit libraries).

相关问题:

  • <一个href="http://stackoverflow.com/questions/602060/what-is-the-best-way-to-program-against-powershells-x64-vs-x86-variability">What是对PowerShell中的64与86的变异编程最好的方法?的与code运行针对32位和64位架构这个问题的交易。我的问题处理时要确保脚本只违背了正确版本的情况。
  • What is the best way to program against powershell's x64 vs. x86 variability? This question deals with code running against both 32-bit and 64-bit architectures. My question deals with the case when you want to ensure the script only runs against the correct version.

推荐答案

如果你的shell是在.NET 4.0(PowerShell的3.0)运行:

If you're shell is running on .NET 4.0 (PowerShell 3.0):

PS> [Environment]::Is64BitProcess
True

这篇关于确定是否当前PowerShell进程是32位还是64位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆