Jump to content

All my products and services are free. All my costs are met by donations I receive from my users. If you enjoy using any of my products, please donate to support me. Thank you for your support. Tom Speirs

Patreon

Easy way to creat BAT files.


Mute64

Recommended Posts

So ive been using steam as a front end recently. Pretty simple tido by creating a bat file with the directory of the emulator and the directory of the rom.

What I was wondering is there a tool out there to make this process quicker. Currently I copy my bat file then edit the game name in the game directory line then save as the games name then add it to steam. But doing this for every game would be a long processes if only I could right click n auto make a bat file lol.

Link to comment
Share on other sites

Can you pass command line variables to your bat file?

Like game.bat ShovelKnight.exe for example?

Then you can call the variable in the script.

Link to comment
Share on other sites

Here's the way that I would do it, but bear in mind this is purely a rough in (lately I'm more at home using UNIX commands for this sort of thing rather than MS-DOS - if you're interested in learning *nix commands, but don't want to leave the familiarity of a Windows environment, check out Cygwin; it's awesome).

I gather that from your post that you have a single game directory? First you would write out the contents of that directory to a text file:

dir > filename.txt

Then assuming that your bat files use a common command structure, you could read in the contents of the text file you created line by line (using a for loop as Han suggested) and use variable text replacement (as Adultery suggested)

for /f %i in (filename.txt) do @echo %i > %i.bat

As I mentioned this is just sort of a rough guess, and I'm not currently at a location where I can test. The idea is that the for loop in the second block will read each line of the text file you created and output each line into a new batch file named according to the contents of the line. Depending on what you were doing, you might be able to omit the intermediary text file altogether, and directly parse your game directory in a similar fashion. If that seems like something that might work for you, I don't think it would be terribly difficult to tweak these commands into something workable.

Link to comment
Share on other sites

Here's the way that I would do it, but bear in mind this is purely a rough in (lately I'm more at home using UNIX commands for this sort of thing rather than MS-DOS - if you're interested in learning *nix commands, but don't want to leave the familiarity of a Windows environment, check out Cygwin; it's awesome).

I gather that from your post that you have a single game directory? First you would write out the contents of that directory to a text file:

dir > filename.txt

Then assuming that your bat files use a common command structure, you could read in the contents of the text file you created line by line (using a for loop as Han suggested) and use variable text replacement (as Adultery suggested)

for /f %i in (filename.txt) do @echo %i > %i.bat

As I mentioned this is just sort of a rough guess, and I'm not currently at a location where I can test. The idea is that the for loop in the second block will read each line of the text file you created and output each line into a new batch file named according to the contents of the line. Depending on what you were doing, you might be able to omit the intermediary text file altogether, and directly parse your game directory in a similar fashion. If that seems like something that might work for you, I don't think it would be terribly difficult to tweak these commands into something workable.

Sorry, forgive me for my utter lack of knowledge on cmd lines and so forth,

So what i think you a referring to do is create a bat file that will effectively create bat files for my rom/files in my Rom folder.

This is an example of my current Bat file lines that i use.

[ C:\Emulators\Project64\Project64.exe C:\roms\N64\Roms\Conker'sBadFurDay.v64 ]

all my N64 roms are in one folder and most will use the same emulator.

''I gather that from your post that you have a single game directory? First you would write out the contents of that directory to a text file:'' ok i managed to do that :)

''Then assuming that your bat files use a common command structure, you could read in the contents of the text file you created line by line (using a for loop as Han suggested) and use variable text replacement (as Adultery suggested)'' Got a bit lost on what to do on this one ;) , ill do some research n see if i can figure it out.

EDIT: so i have created that txt doc with all my rom names, and have called it roms.txt, then from what i gather i create a BAT file with this line '' for /f %i in (roms.txt) do @echo %i > %i.bat

but yea im not %100 sue what im doing or what this does or how i should be doing it lol.

EDIT2: !!!! did it with this LINE

for /F %%i in (roms.txt) do @echo %%i > %%i.bat

well i created a bunch of bat files all named by the roms lol, noticed some had the file extensions and some didnt, i need them to have file extensions other wise the emulator dosnt load the rom, also the line in the Bat files is just the name of the bat file itself. Also noticed that the bat files that were created are not the exact same same as whats in my roms.txt file, i guess because some of those roms have spaces it creates two bat files for one rom if it was for example '' 1080 snowboarding '' it would create the bat file call 1080 and snowboarding lol. still its progress, ill keep researching.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...