Little help with Batch. D:

Does anyone here know how to work with Batch Files? (.bat)

I know how to code it semi-well but there is one problem I can't figure out.



I am making a custom Mod/Auto Patcher for an Online Game (also future RPGMaker Games)
and I want to find the current directory to copy/replace custom files over the original.

This is how I have it setup as of now.
 

xcopy /y "C:\Users\%USERNAME%\Desktop\Game Mod 1.4\Original Backup Files\Music" "C:\MMO Folder\MMO Game Folder\Music" >nulThe problem is, some users don't use C:\ as their installation drives, I am trying to figure out how to set it up to locate and find the installation folder.

I tried replacing C:\ with %CD% but that doesn't seem to work.
well, you need to be saving where the user installs the files so you can get it back later... most programs write it into the registry


You can also maybe try to find a specific file in the installation to determine where the whole installation is...
well, you need to be saving where the user installs the files so you can get it back later... most programs write it into the registry

You can also maybe try to find a specific file in the installation to determine where the whole installation is...
That's the problem right there.

The mmo I play, for some reason some people have the game installed in their D:\ while some have it installed on their C:\

What I'm trying to figure out is how to LOCATE which drive they have their game installed in, then my program will find that folder and (for now) patch Custom music.

I also have a setup to patch the original files back quicker to.
well, it probably wrote it in the registry to it's worth checking it out (I think you have it installed too, so you can verify this yourself)... you just need to know how to fetch registry info and the exact key used by the game
well, it probably wrote it in the registry to it's worth checking it out (I think you have it installed too, so you can verify this yourself)... you just need to know how to fetch registry info and the exact key used by the game
What exactly do you mean it probably wrote it in the registry ?
Normally, installers write up the installation paths into the windows registry...


normally in either HKEY_CURRENT_USER -> SOFTWARE -> Company/GameName -> more subfolders


or HKEY_LOCAL_MACHINE -> SOFTWARE -> Company/GameName -> more subfolders


for example, the RTP install path is saved in


HKEY_LOCAL_MACHINE -> SOFTWARE -> ENTERBRAIN -> RGSS3 -> RTP (The path is up to here) -> RPGVXAce (the subkey)
I been messing around with Batch.
I can't seem to make it access Regedit related stuff.

There has to be another way to locate a folder on someone's PC/Directory. x.X
then maybe you could really run a search for one of the files in that folder... assuming they don't rename it...

or use other methods than a batch file...
%~dp0 Gives you the absolute path to the directory of the batch file
%cd% Gives you the current working directory (which isn't necessarily the directory of the batch file: you could have started it through a shortcut somewhere else, through a cmd prompt rooted in a different folder, etc.)

See: http://stackoverflow.com/questions/4419868/what-is-the-current-directory-in-a-batch-file

If you're running the batch file from some other folder and want to find out where the installation folder is, then yeah, you need to mess with registry keys. Alternatively, you can just have people install your patcher in the game's installation folder.

Original thread: https://forums.rpgmakerweb.com/threads/little-help-with-batch-d.21163/