IP Cop
IP Cop

Reputation: 21

Batch file to edit and add line into ini file

I want to create a .bat file to push to more than 4000 users to edit lotus notes ini file, to disable the Instant Messenger.

I have to plug in this two lines IM_DISABLE=1 & IM_DISABLED=1

If the lines exist, edit to the new value if it doesn't plug it in.

The ini file is called notes.ini residing in the path C:\Users\PSuriya\AppData\Local\Lotus\Notes\Data

However, this path should be generic to users.

Upvotes: 0

Views: 4425

Answers (2)

Francesco Marzolo
Francesco Marzolo

Reputation: 59

You can use a policy to push notes.ini settings to clients

Upvotes: 0

foxidrive
foxidrive

Reputation: 41224

This should work - test it on some sample users

@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
 )

If the file doesn't exist then it will do nothing for that user.

Upvotes: 1

Related Questions