BAT

For Loop
@echo off
setlocal enabledelayedexpansion
set LIST=(a b c d e)
set a=value of A
set b=value of B
set c=value of C
set d=value of D
set e=value of E

:: deletes the parentheses from LIST
set _list=%LIST:~1,-1%
for %%G in (%_list%) do (
set _name=%%G
set _value=!%%G!
echo !_name! = !_value!
)

Launch directory & working directory
@Echo OFF
Echo Launch dir: “%~dp0”
Echo Current dir: “%CD%”
Pause&Exit

Reading file and looping
FOR /F %%i in (file.txt) DO (
Echo %%i
)
Reading file and looping (line with spaces)
FOR /f “tokens=* delims=,” %%a in (‘type “%1″‘) do (
@echo %%a
)

Write Directory names in file – file / directory basename
Dir /b folder_* >> file.txt

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s