I have a script that is designed to go through a set of MP3 folders, tag replaygain values, and then do file hashes of the files. My code looks like this:
CODE
@ECHO OFF
SET dest="G:\EXPERIMENT\Classical\Classical Masterpieces of the Millennium"
SET gaintool="C:\program files\react2\tools\metamp3.exe"
SET gaintoolopt=--replay-gain
SET hashtool="C:\Program Files\ReHash\rehash.exe"
SET hashtoolopt=-none -crc32 -md5 -sha1 -tiger
SET files=*.mp3
PUSHD %dest%
FOR /D %%f IN (*) DO (PUSHD %%f && TITLE GAIN ANALYSIS %%f && %gaintool% %gaintoolopt% %files% && TITLE HASH ANALYSIS %%f && %hashtool% %hashtoolopt% %files% >> "%%f.hash.txt" && POPD)
SET dest="G:\EXPERIMENT\Classical\Classical Masterpieces of the Millennium"
SET gaintool="C:\program files\react2\tools\metamp3.exe"
SET gaintoolopt=--replay-gain
SET hashtool="C:\Program Files\ReHash\rehash.exe"
SET hashtoolopt=-none -crc32 -md5 -sha1 -tiger
SET files=*.mp3
PUSHD %dest%
FOR /D %%f IN (*) DO (PUSHD %%f && TITLE GAIN ANALYSIS %%f && %gaintool% %gaintoolopt% %files% && TITLE HASH ANALYSIS %%f && %hashtool% %hashtoolopt% %files% >> "%%f.hash.txt" && POPD)
The script works fine on it's own, but I want to add more commands and get a better understanding of how BATs work. I have been told I can pass variables between one BAT and another, but every reference I find doesn't give an example! All I need to see is a really simple example of one BAT calling another, and the called BAT using variables of the first. The second one echoing variables from the first and it's own variables would be fine.
Any suggestions?
QUOTE(Update 1)
I rewrote the code using Greynol's suggestion as it makes my life that much easier. Synthetic Soul, thanks again for showing how to pass variables from one BAT to another, however I did not imagine that the variables I passed would somehow retain their original names.
Also, as Synthetic Soul pointed out, Windows does seem to use the modify date. I ran a program that changes such values, and my BAT works alphabetically now.
CODE
@ECHO OFF
SET dest=G:\MEDIA\CDDA_ARCHIVE\Classical
SET gaintool="C:\program files\react2\tools\metamp3.exe"
SET gaintoolopt=--replay-gain
SET hashtool="C:\Program Files\ReHash\rehash.exe"
SET hashtoolopt=-none -crc32 -md5 -sha1 -tiger
SET files=*.mp3
PUSHD "%dest%"
FOR /D %%f IN (*) DO (
TITLE %%f
ECHO %%f
PUSHD "%dest%\%%f\Classical Masterpieces of the Millennium (1999)\"
TITLE %%f Gain Analysis
ECHO ----- Gain Analysis
%gaintool% %gaintoolopt% %files%
TITLE %%f Hash Analysis
ECHO ----- Hash Analysis
%hashtool% %hashtoolopt% %files% >> "%%f.hash.txt"
ECHO ----- %%f processing complete
POPD
)
SET dest=G:\MEDIA\CDDA_ARCHIVE\Classical
SET gaintool="C:\program files\react2\tools\metamp3.exe"
SET gaintoolopt=--replay-gain
SET hashtool="C:\Program Files\ReHash\rehash.exe"
SET hashtoolopt=-none -crc32 -md5 -sha1 -tiger
SET files=*.mp3
PUSHD "%dest%"
FOR /D %%f IN (*) DO (
TITLE %%f
ECHO %%f
PUSHD "%dest%\%%f\Classical Masterpieces of the Millennium (1999)\"
TITLE %%f Gain Analysis
ECHO ----- Gain Analysis
%gaintool% %gaintoolopt% %files%
TITLE %%f Hash Analysis
ECHO ----- Hash Analysis
%hashtool% %hashtoolopt% %files% >> "%%f.hash.txt"
ECHO ----- %%f processing complete
POPD
)
Also, as Synthetic Soul pointed out, Windows does seem to use the modify date. I ran a program that changes such values, and my BAT works alphabetically now.
