Discussion Locked

Removing specific string in autoexec.bat

0 helpful
9 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I am trying to find a way to remotely edit approximately 5000 Win9X machines. What I need to do is REMARK (REM out) one particular string that could be located anywhere in the autoexec.bat. Does anyone have any idea of how this can be done? Java script or any other type of script? Or better yet has anyone done it? I really don't want to have to visit all these machines or do individual remote sessions for each machine.

9 replies

by maelgwyn

It is possible to do this:

Make a new Autoexec.bat file and sit it on the authentication server.

When each user logs in, make a script that copies the file across the connection, so then the new file is propagated onto each machine almost automatically.

Ok, this may help you, but it also may not, especially if there is different autoexec.bat files across the whole board, then you may need to do some remote access to any non standard file(s)

Hope it helps

Maelgwyn

by dennis london

Thanks for the answer but with over 5K Win9X machines you know as well as I do that only about 100 (if I'm lucky) are anywhere near COE standards. They're all going to have some sort of slight variation to them.

by joseph moore

I had a similar problem, trying to update over 100 HOSTS files. I had to remove a single line in them, so I used the FIND command. I copied the HOSTS file to a shared folder (calling the copy of the file the computer name it came from using the %computername% variable), then I ran the following:

FIND /V /I "Text To Remove" \\SERVER1\SHARE1\%computername%.txt> \\SERVER1\SHARE1\%COMPUTERNAME%2.TXT

That searched throughout the entire file, looking for everything EXCEPT the text string I wanted to remove; it then made a NEW file that was exactly like the old HOSTS file, EXCEPT the line I wanted removed was NOT in there.

I then just replaced the old HOSTS file with my new copy.

I can send you the whole BAT file script if you like asan example. You can change it to fit your needs.

hope this helps

by dennis london

Tried it and it worked on almost twenty machines. Thanks but I still need something that will actually search through the autoexec.bat file instead of replacing what's already there.

by dennis london

Tried this as well and noticed that this doesn't search the autoexec.bat either. Good idea but not what I need.

by dennis london

Point value changed by question poster. I need something that will "search" through the autoexec.bat file and automatically REM out or replace specified string.

This discussion is closed to new replies.