随笔分类 -  powershell

摘要:Read-Host 获取用户输入值Write-Host 输出回显$newName=Read-Host"Pleaseinputthenewnameforthestring'test',leaveasdefault,pressEnter:"Write-Host"Processing..."$newLine=[System.Environment]::NewLine$dir=(Get-Location).Path+"\"$file=$dir+"test.txt"$a+=Get-Content$fileif 阅读全文
posted @ 2011-12-13 16:49 Simon_Chen 阅读(1108) 评论(0) 推荐(0)
摘要:for /f "tokens=*" %%a in ('powershell Get-ExecutionPolicy') do (set originPolicy=%%a)通过for循环查找功能来将 powershell 命令的值赋给 batch file 变量@echooffsetdir=%CD%setscriptPath=%dir%\example.ps1for/f"tokens=*"%%ain('powershellGet-ExecutionPolicy')do(setoriginPolicy=%%a)powershe 阅读全文
posted @ 2011-12-13 16:40 Simon_Chen 阅读(1940) 评论(0) 推荐(0)