Search the Community
Showing results for tags 'batch'.
Found 1 result
Hey everyone, I have assembled some useful Windows Batch Files to help with the automatic zipping for roms and other tasks. To create the .bat file simply create a text document within Windows and name it what you would like and make sure the extension is .bat Then you want to right click and press 'edit' in order to add text to the document. Simply copy and paste one of the following code and save it. By default windows doesnt normally allow you to see extensions of known file types so you may have to do a quick Google Search on how to show file extensions on all files If you would like to change the compression type to either 7z or zip, simply replace the extension where it says either .7z or .zip to the compression type you want. Some of these file can/may be improved, as these arnt perfect, however they may help you like they have helped me. NOTES You must have 7z installed on the computer. I have included the default directory to 7z however double check your directory to make sure its in the same place, otherwise change it to the correct directory All Batch files should be in the same directory you would like the operation, this means the .bat files are portable. So sometimes the Batch file may also be ziped up 😐 ----- BatchFolder2zip.bat The below code automatically zips the files inside folders with the folders name. This is useful for zipping up Foldered roms but dont want to zip up the folder as well. This is useful for SkumVM if you wanted to convert your folder rom set to ZIP for /d %%X in (*) do "C:\Program Files (x86)\7-Zip\7z.exe" a "%%X.zip" "./%%X/*" Pseudo Code: For content inside every folder for any extension run 7z and add the contents inside folder and name the zip the same as the folder. --------------------- BatchFile27z.bat This automatically zips all files within the same directory of the batch file into a 7z. Useful for making NES or snes roms into 7z, or pretty much any standalone rom FOR %%i IN (*.*) DO "C:\Program Files (x86)\7-Zip\7z.exe" a "%%~ni.7z" "%%i" Pseudo Code: For the name of every file with any extension use 7z.exe to create a zip with the current name minus extension. ------------------- BatchFilesInFolder27z.bat So what this does is it puts all the files inside multiple folders in the current directory into a 7z file outside the folder. HOWEVER it only zips the files within the folder if they have the same name but can have different extentions. For example Folder name is Crash_Bandicoot and inside the folder is Crash Bandicoot (USA).bin and Crash Bandicoot (USA).cue. The batch file will automatically zip both files inside the folder (because they have the same name) and place the zip outside that folder called Crash Bandicoot (USA).7z. Just keep in mind, this will also automatically zip any other file with a different name in its own zip such as track01.bin files. etc FOR /r %%i IN (*) DO "C:\Program Files (x86)\7-Zip\7z.exe" a "%%~ni.7z" "%%i" Pseudo Code: For files inside directory with any extension use 7z to add files to 7z with name INSIDE folder pairing it up with files of the same name ------------------ BatchFile2Folder2Manual.bat For every PDF/anyfile [Replace(*.pdf*) with (*.*) or for text files (*.txt*)] file, it will create a folder of the same name and then rename the file to Manual.pdf. It will then move that file into the folder. This is useful for Manuals downloaded from EmuMovies Download Service as it downlaods the manual as the name of the game and to follow the structure of RocketLaunch, its normally in games name folder. FOR %%i IN (*.pdf*) DO md "%%~ni" & ren "%%i" Manual.pdf & move Manual.pdf "%%~ni" Pseudo Code: For every file name that ends with .pdf, create a folder with the PDF file name without .pdf and rename the pdf file to Manual.pdf then move the file into the folder just created. ------------------ RenameFolderBasedOffFileName.bat This simply renames the folder based off the file name of whats inside the folder. Im not entirely sure the affect this has on multiple files within the folder so please try in a separate area before use for /d %%a in (*) do ( for %%b in ("%%a\*.*") do ( ren "%%a" "%%~nb" ) ) ------------------ RenameFilesInFolder2FolderName.bat This basically renames the files within the folder with the name of the folder. It specifically looks for iso/bins/cue and renames them based off the folder name. This is a dirty and is slower in performance however it does get the job done. If you wanted different file extensions, just change the the bin/cue/iso to another file extension. You can remove or add lines if necessary. This may cause conflict if you have more than one file in the folder with the same extension, however shouldn't matter if they are different extensions (bin/cue). Please try this in a separate area before using it in your main folders. for /r %%F in (*.bin) do @for %%A in ("%%F\..") do ren "%%F" "%%~nxA.bin" for /r %%F in (*.iso) do @for %%A in ("%%F\..") do ren "%%F" "%%~nxA.iso" for /r %%F in (*.cue) do @for %%A in ("%%F\..") do ren "%%F" "%%~nxA.cue" ------------------ I am aware that there may be other utilities that can do the same thing such as Dons Rom Rename however these batch files may have other use cases and I am only sharing them because I found them useful, and it may help others as well. I would recommend that you test it on a smaller batch to test it out before converting your entire rom library TIP: If you would like to see the progress when it finishes or want to debug it, Press enter at the end of the line and add PAUSE under the code If you have any useful batch files or improvements to the ones here, dont hesitate to share them. Cheers