Dos中常用的命令

1.  重定向

cmd >file                    standard output 重定向到file

cmd 1> nul 2>&1        无输出.

cmd 1> file 2>&1        standard output 重定向到file, standard error 重写向到 file.

cmd 1>> file 2>&1      standard output 重定向到file, standard error 重写向到 file. 均为追加模式。

 

2. findstr

findstr /NI /C:": error " file           在File中搜索字符串": error ", 不区分大小写

findstr /m /s /d:d:\ ".*" *.txt       搜索D盘下所有目录及子目录,显示所有match ".*"的txt文件的文件名

if %ERRORLEVEL% == 0 goto ERROR

 

3. if or not

if not exist folder md folder           如果不存在folder, 则创建folder

IF /I "%vv%"=="OK" (
...

) ELSE (

...

)                                                 如果%vv%=="OK" (不区分大小写), 则...

 

 

转载于:https://www.cnblogs.com/DataFlow/archive/2012/05/03/2480744.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值