LoginSignup
10
10

More than 5 years have passed since last update.

備忘録バッチファイル

Last updated at Posted at 2014-07-25

etc

コメントの書き方

現在いるディレクトリの絶対パスを取得

%cd% と書く。
使用例↓

csvmake4 c:\mydoc\test.xls %cd%\xlstemp

for

forループ内でカウンタを用いる

通常の環境変数ではカウントアップ/カウントダウンができない。
そこで遅延環境変数を用いる。

setlocal ENABLEDELAYEDEXPANSION

set /a num=0

for %%i in (*.txt) do (
    set /a num=num+1
    echo count:!num!
)

setlocal ENABLEDELAYEDEXPANSION で宣言しておく必要がある。
遅延環境変数は %num% ではなく !num! と囲む。

http://d.hatena.ne.jp/inspfightman/20080705/1215253544
http://ameblo.jp/phyco/entry-11595146120.html

10
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
10