Hello. There is a file with approximate content:

#text text2 text3 #text4 text5 

I need to read the file line by line and if the first character of the line is not # written to another file as "some_text line_from_first_file". Ie having worked on the file from the example, the script should give me:

 ΠΊΠ°ΠΊΠΎΠΉ-Ρ‚ΠΎ_тСкст text2 ΠΊΠ°ΠΊΠΎΠΉ-Ρ‚ΠΎ_тСкст text3 ΠΊΠ°ΠΊΠΎΠΉ-Ρ‚ΠΎ_тСкст text5 

I tried this:

 set file=file.txt for %%i in (%file%) do ( set test=%%i set var=%package:~0,1% if not "%var%" == "#" echo "ΠΊΠ°ΠΊΠΎΠΉ-Ρ‚ΠΎ_тСкст %test%" >> new_file.txt ) 

But nothing works. Advised:

 for /f %%i in ('findstr /v ^# file.txt') do echo ΠΊΠ°ΠΊΠΎΠΉ-Ρ‚ΠΎ_тСкст %%i >> new_file.txt 

But also does not work. Thanks in advance for your help

    1 answer 1

     @FOR /F %x IN ('findstr /B /V /C:# file.txt') DO @ECHO ΠΊΠ°ΠΊΠΎΠΉ-Ρ‚ΠΎ_тСкст %x >> file2.txt 

    If the code in the batch file double the percent sign. Well, with the encoding do not write ...

    • Everything works, thank you. - Anar Sultanov