windows 7 与 PowerShell 2.0
来源:互联网 发布:linux find权限不够 编辑:程序博客网 时间:2024/06/06 08:23
2012.9.4 发布了 POWERSHELL 3.0
windows 7 与 PowerShell 2.0
windows 7 不需要下载安装 PowerShell 2.0 了,在windows 7发布的时候已经内置了 PowerShell 2.0
对于 windows 2008 R2来说,也是如此。
//z 2012-3-2 18:02:51 PM IS2120@CSDN
可以通过两种方式来查看:
1. get-host
Name : ConsoleHost
Version : 2.0
InstanceId : 64afc087-40cb-4b55-b3d3-d9dd389cb2eb
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
2. $PSVersionTable 环境变量
该变量只在版本2.0中定义了
Name Value
---- -----
CLRVersion 2.0.50727.5448
BuildVersion 6.1.7601.17514
PSVersion 2.0
WSManStackVersion 2.0
PSCompatibleVersions {1.0, 2.0}
SerializationVersion 1.1.0.1
PSRemotingProtocolVersion 2.1
//z 2012-3-2 18:02:51 PM IS2120@CSDN
3. 已经发布 3.0 了。。。
2011年年底(12月)发布了 3.0
//z 2012-3-2 18:02:51 PM IS2120@CSDN
4. 类似 grep
Example of grep -R equivilant: Get-ChildItem -recurse -include *.txt | Select-String -CaseSenstive "SomeString"
提供三种方法
1. 直接使用 Get-Host
2. 使用$host变量
3. 检查$PSVersionTable变量,PS2里有$PSVersionTable变量,而PS1里没有
windows 7 与 PowerShell 2.0
windows 7 不需要下载安装 PowerShell 2.0 了,在windows 7发布的时候已经内置了 PowerShell 2.0
对于 windows 2008 R2来说,也是如此。
//z 2012-3-2 18:02:51 PM IS2120@CSDN
可以通过两种方式来查看:
1. get-host
Name : ConsoleHost
Version : 2.0
InstanceId : 64afc087-40cb-4b55-b3d3-d9dd389cb2eb
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
2. $PSVersionTable 环境变量
该变量只在版本2.0中定义了
Name Value
---- -----
CLRVersion 2.0.50727.5448
BuildVersion 6.1.7601.17514
PSVersion 2.0
WSManStackVersion 2.0
PSCompatibleVersions {1.0, 2.0}
SerializationVersion 1.1.0.1
PSRemotingProtocolVersion 2.1
//z 2012-3-2 18:02:51 PM IS2120@CSDN
3. 已经发布 3.0 了。。。
2011年年底(12月)发布了 3.0
//z 2012-3-2 18:02:51 PM IS2120@CSDN
4. 类似 grep
Example of grep -R equivilant: Get-ChildItem -recurse -include *.txt | Select-String -CaseSenstive "SomeString"
Get-ChildItem -recurse -include *.txt | Select-String -CaseSensitive "SomeString"
function pgrep { param([string]$search, [string]$inc) Get-ChildItem -recurse -include $inc | Select-String -CaseSensitive $search }
pgrep SomeStringToSearch *.txt
Then to really make it magical, add the function alias to your PowerShell Profile and you can almost dull the pain of not having proper command line tools.提供三种方法
1. 直接使用 Get-Host
PS C:\Users\TopSage> Get-Host
Name : ConsoleHost
Version : 2.0
InstanceId : b354f4bf-ff4e-452a-b747-78267a914c0a
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : zh-CN
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
2. 使用$host变量
PS C:\Users\TopSage> $host.version
Major Minor Build Revision
----- ----- ----- --------
2 0 -1 -1
3. 检查$PSVersionTable变量,PS2里有$PSVersionTable变量,而PS1里没有
PS C:\Users\TopSage> if (test-path variable:psversiontable) {$psversiontable.psversion} else {[version]"1.0.0.0"}
Major Minor Build Revision
----- ----- ----- --------
2 0 -1 -1
//z 2014-04-23 15:30:34 L.252 BG57IV3@XCL T138147975 .K.F253293061 [T286,L3964,R187,V5273]
启动PowerShell
在Win7中点击“开始→所有程序”,在“附件”中有个Windows PowerShell,点击展开Windows PowerShell,里面有Windows PowerShell ISE和Windows PowerShell这两个选项(图1),后者是CMD那样的命令行模式界面,前者是图形化的PowerShell开发环境、包含了调试功能和交互式控制台,适合PowerShell编程的用户使用。
除了以上方法能启动PowerShell,在传统的CMD窗口中输入PowerShell回车也能启动PowerShell,与CMD不同,PowerShell的提示符是PS开头的(图2);
如要启动PowerShell ISE,可以点击“开始→所有程序→附件→Windows PowerShell→Windows PowerShell ISE”,这是一个集成的脚本环境(图3),里面有3个窗格,在顶部窗格中你可以练习编程创建或编辑脚本,中间是运行结果,最下方窗格中能输入运行 PowerShell命令。
- windows 7 与 PowerShell 2.0
- windows 7 PowerShell 笔记
- windows 7 PowerShell 笔记
- PowerShell 2.0 CTP: Windows PowerShell 调试器
- Windows PowerShell 2.0语言对象与对象类型
- Windows PowerShell 2.0命令别名技巧与内置别名
- Windows PowerShell 2.0 CTP 下载
- Windows PowerShell 2.0之输入输出
- Windows PowerShell
- Windows powershell
- windows powershell
- windows powershell
- Windows PowerShell 2.0社区技术预览版(CTP)下载与说明
- Windows PowerShell 2.0之与COM对象交互(一)COM基础
- Windows PowerShell 2.0十大新特性
- 抢先体验 Windows PowerShell 2.0 全新技术
- Windows PowerShell 2.0 语言之循环语句
- Windows PowerShell 2.0 开发之命令别名
- 碎碎念【1】- 新的不一定好——OllyDbg2.01和1.1
- jquery获得select option的值 和对select option的操作
- 解读Windows2000/XP分层驱动模型
- uninitialized constant Rake::DSL解决
- 白盒测试实例--9构建自己的单元测试框架2(完整代码)
- windows 7 与 PowerShell 2.0
- 深度优先搜索
- uclinux创建内核线程的几种方式
- win7 + ubuntu 重装win7后修复ubuntu引导
- 一大牛的分页存储过程
- 基于JTA的事务管理概念
- 用java的servlet实现http访问mongodb中的文件
- 接受sendmessage(application.handle..)的消息?
- InternetExplorer.Application对象的Documen属性