buf

BE something YOU love and understand
posts - 94, comments - 35, trackbacks - 0, articles - 2
   :: 首页 :: 新随笔 :: 联系 ::  :: 管理

无聊,写了一小段批处理代码

Posted on 2008-01-26 21:01 buf 阅读(292) 评论(0)  编辑 收藏 引用 所属分类: Misc

一开始还真搞不明白~n选项是怎么用的 d-__-b


rem 0、将当前目录下所有xxx.sub压缩为xxx.rar然后删除xxx.sub
rem 1、在for语句中要使用%%x定义变量,而不是%x
rem 2、普通变量的引用形式:%变量名%
rem 3、使用~n选项仅将相应变量扩充到文件名(即去掉了后缀部分)

 

@echo off
set RAR="c:\program files\winrar\rar.exe"
for %%a in (*.sub) do %RAR% A -df %%~na.rar %%a


 

只有注册用户登录后才能发表评论。