0

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.

Vikrant
  • 4,920
  • 17
  • 48
  • 72
IP Cop
  • 21
  • 1
  • 1
  • Re: `If the lines exist edit to the new value if it doesn't plug it in.` Is the position of the lines critical, or can they be added onto the end of the file? – foxidrive Nov 28 '14 at 06:05
  • no the position is not critical and it could be added at the eof – IP Cop Nov 28 '14 at 06:08
  • 1
    It's nice that you've stated your requirements. Have you made any effort to fulfill them yourself (including researching previous questions about modifying text files from a batch file)? I see several previous questions in the Related list to the right of this question that should at least allow you to make an attempt at doing so. – Ken White Nov 28 '14 at 06:34
  • Hi Ken, Yes i have tried other solution but they were not successful as it cleared the ini file and left only the characters i had intended to enter, some just wrote some character, it might be cos i dint get each line of it so id posted the question asking for a more straight forward approach. Thank for your concern. – IP Cop Dec 02 '14 at 03:08

2 Answers2

1

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.

foxidrive
  • 40,353
  • 10
  • 53
  • 68
  • Hi Foxi, Wow thank s alot buddy it totally worked this was exactly what i was looking for simple and readable code. my man..cheers buddy. – IP Cop Dec 02 '14 at 03:09
0

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