1.

Solve : batch file to change ini?

Answer»

I have a program installed silently on few windows 7 clients.
But problem is because users need to make some settings before use it and that is problem.
Now I have saved settings and distribute it to clients in settings.ini
but problem is because in settings.ini is folder of my profile, like
c:\users\mike\documents

now I need to CHANGE my name Mike with the name of user on the client pc.

so batch will find in settings.ini mike and change it with current username.Type this in a cmd prompt:

Code: [Select]set u

Without details about your task, that will at least give you a clue.I already tried that to change to change a line in settings.ini
from
c:\users\mike\documents

to

c:\users\%username%\documents

but not working

when I go to software it shows me

c:\users\%username%\documents


instead

c:\users\george\documents

or
c:\users\tina\documents

or

c:\users\sam\documents

So I need to change that with batch when user logs in.settings.ini is not a batch file, right?

If you describe your task in technical terms then you are LIKELY to get a solution.
Or just provide enough details about the task so any readers don't have to guess what you are doing.the thing here is, that I am trying to change that line in settings.ini with a batch.
So batch will find which user is currently logged in and change the line in path to right one.
So after that path will be set for current logged in user.

problem is this path in settings.ini
c:\users\mike\documents


user Tina (username) can not save in that folder so that's why I need batch, to change that.maybe ti will help location of settings.ini in my case
it is under c:\users\mike\appdata\roaming\prts\settings.ini

so some other user have it in
c:\users\tina\appdata\roaming\prts\settings.iniOk, it's easy to find out the current users profile location.

Which line of settings.ini has to be changed?
How will this be changed - will you supply the users the batch file to run to change settings.ini ?

Can you use any tool to perform the editing of settings.ini? Quote from: foxidrive on March 05, 2015, 07:28:53 AM

Ok, it's easy to find out the current users profile location.

Which line of settings.ini has to be changed?
How will this be changed - will you supply the users the batch file to run to change settings.ini ?

Can you use any tool to perform the editing of settings.ini?
Now is in line 42
I am not soure about that line, because line may change if you change settings in software which use settings.ini
I need to test some more for that.

yes I intent to supply batch to user by system and run batch file by system on every user when he logs in

tool for editing settings.ini, I use notepad.If each path is different 1 batch won't suit your needs... Quote from: Blisk on March 05, 2015, 12:07:38 PM
Now is in line 42
I am not soure about that line, because line may change if you change settings in software which use settings.ini
I need to test some more for that.

If you want an exact solution: then providing a sample settings.ini file with a description of which line needs to change will let someone help you.

Quote

yes I intent to supply batch to user by system and run batch file by system on every user when he logs in

tool for editing settings.ini, I use notepad.

Notepad can't be scripted in a batch script.
We need to know what tools can be used to edit your file within a batch script.


here is settings.ini
http://zerobin.povej.net/?91ea09e70c9e153b#bSapGkskui9/Ms46E8+zAnoVZourlGlpRMURDoW0MhA=

about tool don't know what you mean. Installed is windeows 7 system.
If there is needed some extra tool just let me know and I will check if I can install that on clients.

I found some batch which is something like I need if that helps?
But I can not complete it for my task.
maybe can help for making my batch?

Code: [Select]echo off
set "file=%userprofile%\AppData\Local\Lotus\Notes\Data\notes.ini"
if exist "%file%" (
   findstr /v /i "IM_DISABLE= IM_DISABLED=" "%file%" >"%file%.tmp"
   >>"%file%.tmp" echo/IM_DISABLE=1
   >>"%file%.tmp" echo/IM_DISABLED=1
   move /y "%file%.tmp" "%file%" >nul
 )Give this a shot:

Code: [Select]echo off
call jrepl "^OutputFilePath=.*" "OutputFilePath=%userprofile%\documents" /f settings.ini /o -

This uses a helper batch file called `Jrepl.bat` (by dbenham) - DOWNLOAD from:  https://www.dropbox.com/s/4otci4d4s8x5ni4/Jrepl.bat

Place `Jrepl.bat` in the same folder as the batch file or in a folder that is on the path.

Be aware that Modern Windows protects the user from unknown downloaded files so it may be blocked
 - if you are happy to try it and it is blocked then
* Right click the bat file
* select the properties
* and click unblock.
runas administrator doesn't make any problem so yes I can use that in folder with batch.>Thanks this WORKS great!
I have just one problem, replacing settings ini must be when software is off.
So first I need to do is taskkill
and than run this batch to change settings.ini

Is there a way to check first if that settings is already changed and if it is, than won't change it?
Like if name Mike exist in settings.ini than must be changed if it deosn't exist than it is already changed.
OK I manage that by myself.
Thank you for helping now all works great!


Discussion

No Comment Found