First post, by Guest
Hey guys, a while back I wrote a W2k/XP batch file that scans a folder and its subfolders for .EXE, .COM and .BAT files, then for each file it finds it creates a batch file that launches that file using DOSBox. I find it very handy and I hope you do too. I especially hope a real programmer improves it or, even better, integrates the idea into future DOSBox releases.
You will probably need to edit the variables to reflect your system: dosbox location, source folder you want it to scan, destination where you want the batch files created, and DOSBox command line switches.
Use at your own risk and feel free to do whatever you want with this.
@ECHO OFFSETLOCALREM DOSBox Shortcutter for Windows 2000 or XPREM Version 0.1REM by DPainter (shift838@yahoo.com)REMREM Use at your own risk!REM Change these variables to reflect your system setup.SET dosbox=C:\DOSBOXSET source=C:\DOSBOX\GAMESSET destination=C:\DOSBOX\RUNSET switches=-exitCLSECHO DOSbox Shortcutter v0.1 by DPainterECHO.IF NOT EXIST %destination%\NUL GOTO errorIF NOT EXIST %dosbox%\NUL GOTO error:beginfor /f "tokens=*" %%c in ('cd') do set homedir=%%ccd %source%for /f "tokens=* delims=\" %%a in ('dir /s *.EXE *.BAT *.COM /b') do (SET FullPath=%%aSET ShortName=%%~dpaSET filename=%%~nxaCALL :process)GOTO :end:processREM File names to skip. Add others if you find them.IF /i "%filename%"=="DOS4GW.EXE" GOTO :SKIPIF /i "%filename%"=="ADLIB.COM" GOTO :SKIPCD %ShortName%FOR /f "tokens=* delims=\" %%d in ('cd') do set foldername=%%~ndIF EXIST %destination%\%foldername%__%filename%.bat GOTO :EXISTSECHO Creating %foldername%_%filename%.bat in %destination%ECHO %dosbox%\dosbox.exe %switches% "%FullPath%" > "%destination%\%foldername%__%filename%.bat"GOTO :end:EXISTSECHO !! Already exists '%foldername%__%filename%.bat'GOTO :end:SKIPECHO !! Skipping %FullPath%...GOTO :END:errorECHO.ECHO There was an error. Ensure your variables are correct.
ECHO.GOTO :eof:endSET dosbox=SET source=SET destination=SET switches=CD %HOMEDIR%ENDLOCALgoto :eof
