Need clarification on CSV batch file syntax

October 2, 2011 at 11:08:08
Specs: Windows XP
hello Matt123

in ur below example in this thread -

http://www.computing.net/answers/pr...

i am not undestanding the syntax of why *%%a*.CSV is used . can u please clarify my doubt, as it why %%a is used in between * * and please let know when this can be used .

@ECHO OFF
SETLOCAL EnableDelayedExpansion

FOR %%a IN (Fact) DO (
MOVE "C:\SourceTest\*%%a*.CSV" "C:\DestinationTest"
)
PAUSE


See More: Need clarification on CSV batch file syntax

Report •


#1
October 2, 2011 at 20:52:47
The script below is probably more accurate. First, we output the results of dir c:\sourcetest to fact.txt. Fact.txt now contains a list of every .csv file in c:\sourcetest. Then the for loop uses each line in fact.txt to do the move command. %%a is the loop variable for each line in fact.txt.


@ECHO OFF
SETLOCAL EnableDelayedExpansion

dir /b c:\sourcetest\*.csv > Fact.txt

FOR %%a IN (Fact.txt) DO (
MOVE "C:\SourceTest\%%a" "C:\DestinationTest"
)
PAUSE


Report •
Related Solutions


Ask Question