VOGONS

Common searches


First post, by Guest

User metadata

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 OFF
SETLOCAL

REM DOSBox Shortcutter for Windows 2000 or XP
REM Version 0.1
REM by DPainter (shift838@yahoo.com)
REM
REM Use at your own risk!

REM Change these variables to reflect your system setup.

SET dosbox=C:\DOSBOX
SET source=C:\DOSBOX\GAMES
SET destination=C:\DOSBOX\RUN
SET switches=-exit

CLS
ECHO DOSbox Shortcutter v0.1 by DPainter
ECHO.
IF NOT EXIST %destination%\NUL GOTO error
IF NOT EXIST %dosbox%\NUL GOTO error

:begin
for /f "tokens=*" %%c in ('cd') do set homedir=%%c
cd %source%
for /f "tokens=* delims=\" %%a in ('dir /s *.EXE *.BAT *.COM /b') do (

SET FullPath=%%a
SET ShortName=%%~dpa
SET filename=%%~nxa

CALL :process
)
GOTO :end

:process
REM File names to skip. Add others if you find them.

IF /i "%filename%"=="DOS4GW.EXE" GOTO :SKIP
IF /i "%filename%"=="ADLIB.COM" GOTO :SKIP

CD %ShortName%
FOR /f "tokens=* delims=\" %%d in ('cd') do set foldername=%%~nd
IF EXIST %destination%\%foldername%__%filename%.bat GOTO :EXISTS
ECHO Creating %foldername%_%filename%.bat in %destination%
ECHO %dosbox%\dosbox.exe %switches% "%FullPath%" > "%destination%\%foldername%__%filename%.bat"

GOTO :end

:EXISTS
ECHO !! Already exists '%foldername%__%filename%.bat'
GOTO :end

:SKIP
ECHO !! Skipping %FullPath%...
GOTO :END

:error
ECHO.
ECHO There was an error. Ensure your variables are correct.
Show last 11 lines
ECHO.
GOTO :eof

:end
SET dosbox=
SET source=
SET destination=
SET switches=
CD %HOMEDIR%
ENDLOCAL
goto :eof

Reply 1 of 2, by icemann

User metadata
Rank Member
Rank
Member

Personally I hate the idea of having a million and one batch files laying around the place. Most games have between 3-6 .exe, .com or .bat files in the one directory. Which overtime would result in ALOT of batch files being created. I`d rather just type "cd blah" and then the name of whatever I`d like to run for the full dos experience personally.

Two stones, two crosses, the rest is just icing. - 7th Guest