.bat that creates backups and replaces text.

November 1, 2012 at 04:11:18
Specs: Windows 8 Pro x64, Intel Core 2 DUO , 8GB
Hi,
So I'm creating an automatic .bat file that finds the user's .ini file , and replaces the word Compressed or UnCompressed to RAW , but the problem is all I found was .vbs scripts , which didn't work as char 1 in line 22 is always wrongs....
however, what I have here is a .ini file that tells the program the settings files , so it looks for save type whether it is Compressed/UnCompressed/Raw , so , by default the program saves it as Compressed , which is not compatible with any other program.

What I need to do is a .bat file that looks like this:

@echo off
echo/////////////no$GBA to VBA Converter////////////
echo/////////Thanks for using this software////////
echo Press Any Key to modify the NO$GBA.INI file
pause >nul
copy NO$GBA.INI NO$GBA.INI.BACKUP
::[Here comes the replace code which replaces Compressed to Raw]
::[Here comes the replace code which replaces UnCompressed to Raw]
cls
echo BackUp Created Succesfully
ping localhost -n 3 >nul
cls
echo your file has been modified.
echo Now you have to open the emulator and resave then close the emulator
echo for the conversion to be completed successfully.
pause >nul
cls
echo Enter Below the name of the save file you want to make a backup for (go to Battery Folder and search for the name) without the extension ".sav"
echo _________________________________________
set /P savename="Save File Name: "
copy Battery/%savename%.sav "Battery/%savename%.sav.backup"
echo Check Above to see if it succeeded or failed. (it should say 1 files copied)
echo if it succeeded you would see the file %savename%.sav.backup inside Battery Folder
pause >nul
cls
echo Press AnyKey to Launch the Emulator
pause >nul
start no$gba.exe


Ok , so for the first code I need a code that copies the settings.ini and saves it as setings.ini.bak , simple but I dont memorize the code.

the second and 3rd codes I need an automatically replace code.

the fourth code , is a code that gets the user's input , and creates a backup of the file he specified. i.e: the file we need a backup of is called gamesave.sav , and it is located under "Battery/" so I need the user to type here gamesave.sav and the .bat will automatically create a copy of "Battery/gamesave.sav" and names it gamesave.sav.bak


Thanks :)


See More: .bat that creates backups and replaces text.

Report •


#1
November 1, 2012 at 04:19:49
I found the copy and backup code for the first one , now I need the copy and backup code that uses the user's input.

I found the 2nd Copy Code , I used:

set /P savename="Save File Name: "
copy Battery/%savename%.sav "Battery/%savename%.sav.backup"

but the problem is that I get an Arrow -> in the end? Why is that?


Report •

#2
November 2, 2012 at 02:15:13
"but the problem is that I get an Arrow -> in the end? Why is that?"


The end of what?


====================================
Life is too important to be taken seriously.

M2


Report •

#3
November 2, 2012 at 02:42:06
the arrow is in the end of the output file. Forgot to mention

Report •

Related Solutions

#4
November 2, 2012 at 12:10:29
Here you go:
@echo off & setlocal enabledelayedexpansion
set result=Success
echo./////////////no$GBA to VBA Converter////////////
echo./////////Thanks for using this software coded by thebest123456 not thethiny////////
echo.Press Any Key to modify the NO$GBA.INI file
pause > nul
echo f | xcopy "NO$GBA.INI" "NO$GBA.INI.BACKUP" /Q /Y > nul 2>&1
for /f "delims=" %%a in ('type NO$GBA.INI') do set content=!content!%%a
set content=%content:Compressed=Raw%
set content=%content:UnCompressed=Raw%
echo.%content%> NO$GBA.INI
echo BackUp Created Succesfully
ping localhost -n 3 > nul & cls
echo.File has been modified.
echo.Now you have to open the emulator and resave then close the emulator
echo.for the conversion to be completed successfully.
pause > nul & cls
echo.Enter below the name of the save file you want to make a backup for (go to Battery Folder and search for the name) without the extension ".sav"
set savename=?
set /P savename=Enter name to save the file as:
echo f | xcopy Battery\%savename%.sav "Battery\%savename%.sav.backup" /Q /Y > nul 2>&1 || set result=Failed
echo.Result:%result%.
echo.If it succeeded you would see the file %savename%.sav.backup inside Battery Folder.
pause > nul & cls
echo Press AnyKey to Launch the Emulator
pause >nul
start no$gba.exe

Report •

Ask Question