Your code looks fine (I adjusted the quotes and added a backslash)
for /f "tokens=* delims=" %%x in ('dir %INPUT_FOLDER% /b/ad') do move "%INPUT_FOLDER%\%%x" %OUTPUT_FOLDER%
Not sure what the question is though. Environment variables are set by system (type
set at a command prompt to see the system variables) or by the user. You can set your own by using the
set statement in your file for INPUT-FOLDER and OUTPUT_FOLDER.
set input_folder=somevalue
set output_folder=someothervalue
for /f "tokens=* delims=" %%x in ('dir %INPUT_FOLDER% /b/ad') do move "%INPUT_FOLDER%\%%x" %OUTPUT_FOLDER%
You can also pass the values of input_folder and output_folder on the command line, but then the reference changes. For instance if your batch file is named
mybatch, you can pass the values of input_folder and output_folder on the command line:
mybatch somevalue someothervalueYou code changes because the reference is different:
for /f "tokens=* delims=" %%x in ('dir %1 /b/ad') do move "%1\%%x" %2
You can have up to 9 defined command line parameters (%1-%9). %0 is the name of the batch file (
mybatch in this case). You can have more than 9 but you have to
shift which makes for some lively coding.
Passing variables on the command line makes your batch code more useful...you can determine at run time what values to pass to the batch file as opposed to hardcoding them.
PS. The
move command is for files not folders.