0

There is file that exists in each user profile directory and I need to remove the line from the file in each user profile directory. I'm using a batch script to go through each user profile directory, type the file, use findstr to not display the line, and then re-direct the output to itself. For whatever reason this is not removing the line.

SET ProfileBase=%SystemDrive%\Documents and Settings

for /f "tokens=*" %%a in ('dir /b /ad-h "%ProfileBase%"') do type "%ProfileBase%\%%a\myfile" | findstr /v display >> :%ProfileBase%\%%a\myfile"
hsatterwhite
  • 322
  • 2
  • 5
  • 14

1 Answers1

0

Is using win32 versions of sed and find out of the question? Those could easily do it*. Also, PowerShell might be worth a look.

*) find /path/to/files -type f -iname 'filename' -execdir sed -i -e '/^exact line you want to disappear$/d' {} \;

Gnarfoz
  • 698
  • 4
  • 10