.bat reacts to files in a specified folder, how to make it react to files dragged onto it?
I downloaded a batch ringtone converter which allows me to batch convert files in the program's folder\mp3 folder. I like the .bat but I want to modify it so that it doesn't react to files in the \mp3 folder, but in files that are dragged onto the .bat file. And I want that I can drag MULTIPLE files onto it.
Is this possible in anyway? Thanks A LOT in advance. I suppose it's a simple code edit in the .bat below but I am not really an experienced user of Windows .bat files.
Here is the .bat file's code:
@echo off
echo **************************************************************
echo * Convert mp3 into m4r *
echo * *
echo * by gary cheung *
echo * *
echo * This script only convert mp3 into m4r and you should *
echo * unload the m4r using itunes or other methods *
echo **************************************************************
echo.
echo There are no guarantees on running this software.
echo You may even damage your iPhone with it.
echo Consider yourself warnned!
echo.
echo.
echo Are you ready? (To cancel press CTRL+C, to go on presss any key)
pause
echo.
copy "mp3\*.mp3" "temp\*."
for %%x in (temp\*.*) do start /w besweet -S --silent开发者_高级运维 -p -core( -input "%%x" -output "%%x".1 -2ch )
for %%x in (temp\*.1) do start /w faac -w -o "%%x".m4r "%%x"
copy "temp\*.m4r" "m4r\*.*"
del /Q temp\*.*
echo ************* Finish
echo.
echo.
echo Great!
echo.
echo BTW, I'm Gary Cheung who live in Hong Kong. :P
pause
And if you need the whole package, I've uploaded it here.
If you drag-drop a file to a batch-script (.BAT file), the batch-file will be run with the drag-drop item as the first parameter.
So all you need to do is process the first parameter, which is indicated by %1.
For starters, in your .BAT file, add the line near the top:
echo The Drag-Drop file is %1
Then test that to make sure you can drag-drop to your batch file.
I am not sure if/how batch-scripts handle multiple drag-drop, but check the subsequent parameters (%2, %3, %4...) to see if that works for multi-file drag-drop.
精彩评论