随笔分类 -  batch 批处理

摘要: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)
摘要:@echo on 是否输出命令行 若为off 则仅输出命令行中的输出显示%CD% 可获取当前文件所在的路径,其中CD实为 命令行 命令delims= 按指定字符查找每行,分隔成对应列的字符串并给每行加行号tokens=* 按指定值取对应列,* 为取全部字符串for /f "delims=" %%a in ('findstr /n .* %ofile%') do 循环变量文件中每行的字符串,findstr /n .* 为匹配所有字符,并赋值给变量%%afor /f "delims=" %%a in ('type %ofile% 阅读全文
posted @ 2011-12-13 16:33 Simon_Chen 阅读(14862) 评论(0) 推荐(0)