竞争无处不在,青春永不言败!专业撸代码,副业修bug

Talk is cheap , show me the code!



批处理 获取某个文件的,特定 两列,可以修改用来做相关的操作

贴出 批处理 代码:

 

SCHTASKS /Create /SC DAILY /TN hibernate_pc /TR "shutdown /h" /ST 22:00

 

@echo off & cls

title The batch file is in order to locate specified row and column By Frank V1.1
color 1f
mode con cols=115 lines=25
rem 设置变量延迟
setlocal enabledelayedexpansion

rem 输入参数模块
set /p fieldDelim=Please enter field delimeters: 
set /p fileName=Please enter the file(qulified name) which you want: 
set /p specifiedColumnOrder=Please enter the specified column1 number you want to take: 
set /p specifiedColumnOrder2=Please enter the specified column2 number you want to take: 
set /p readOutputFileName=Please enter the output file qulified name


rem 接收传入参数模块
set fieldDel=!fieldDelim!
set /a specifiedColumnOrd=%specifiedColumnOrder%
set /a specifiedColumnOrd2=%specifiedColumnOrder2%
set fileNam=!fileName!
set readOutputFile=!readOutputFileName!


::读取第一行表头的俩 field 以及 指定行的 俩 field ,提示 Missing Operator 的问题没找到原因
for /f "delims=^%fieldDel% tokens=%specifiedColumnOrd%,%specifiedColumnOrd2%" %%i in (%fileNam%) do echo ^%fieldDel%%%i^%fieldDel%^%fieldDel%%%j^%fieldDel%>>%readOutputFile%

type %readOutputFile%
pause>nul

  

posted @ 2016-07-22 17:30  云雾散人  阅读(795)  评论(0编辑  收藏  举报

Your attitude not your aptitude will determine your altitude!

如果有来生,一个人去远行,看不同的风景,感受生命的活力!