Hello, I’m quite ‘green’ in programming and I need your help. I need a batch file which could find specified text line in .ini file, be able to delete that line and type in the text by your choice.
(menu)
@echo off
echo.
set/p NAME=”Please type in desired Steam User Name and press Enter: ”
echo.
echo.
set/p NAME=”Please type in desired Player Name and press Enter: ”
(rev.ini)
need to find these to lines (below) in file, delete PLACEYOURNAMEHERE and replace the text by whatever you type in the menu (above)
SteamUser = PLACEYOURNAMEHERE
PlayerName = PLACEYOURNAMEHERE
I’ve uploaded these files so you could take a good look what happened.
This is the original rev.ini file
http://www.mediafire.com/?gmwzjjytrmg
This is the compiled rev.ini file (I typed mmm for both commands) As you can see new text bits have been added where the original one ends, but instead of replacing PLACEYOURNAMEHERE lines with mmm it adds everything at the very end of the original rev.ini including
those bits.
http://www.mediafire.com/?uk5tny422y2
This is the batch file of yours i’ve modified
http://www.mediafire.com/?yhzyjq2tnkj
I hope you’ll sort something out 😉
Thank you in advance 🙂
Sorry for my English
hey, thanks! that saved us BOTH a lot of time and frustration.
see response #1: I re-posted it with all corrections made (rather than waste space posting again here…)
You prob’ly noticed blank lines are not re-iterated…
I also learned a strange and confusing attribute of IF statements, which i consider to be a true “bug”.
Usually, you can substitute [], @, or any other non-special
char. to enclose a string, but not in a called subroutine. Then you HAVE to use dbl quotes.
the following will NOT work:
for /L %%a in (1 1 3) do (
set xx=”testing”
:: this works here
if [%%a] equ [1] echo first loop
call :testif
)
:testif
:: but not here!
if [%xx%] neq [] echo not null
but this will work:
:testif
if “%xx%” neq “” echo not null
If any other forum-phantoms see this and know why, i would greatly appreciate some enlightenment.