Avatar of Francisco
Francisco
Flag for Japan asked on

remove blank line - windows 7 scripting - to avoid "Echo is off"

hi

I have basic query regarding Windows Scripting on Windows 7 command prompt.

there is batch like below.
<Start of file>
@ECHO off
FOR /F "usebackq eol=; delims=" %%i  IN ("file.sql") DO (

       IF NOT "%%i" EQU "" ECHO %%i >> test.txt
)

ECHO;
ECHO ********************************
pause
<end of file>

input file.sql has multiple blank lines, which will resulted to see lines like this.
ECHO is off.

I would like to avoid this case, would somebody please help to advice how I can simply skip blank line so that "ECHO is off." will not be printed?
Shell ScriptingWindows OS

Avatar of undefined
Last Comment
Francisco

8/22/2022 - Mon
NVIT

If %%i begins with a SPACE character, that would happen.
Francisco

ASKER
thanks, how can I skip that case, a space in addition to blank within this windows script?
SOLUTION
NVIT

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
oBdA

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Francisco

ASKER
Dear NewVillageIT,  oBdA

Thank you very much to both for support! It works perfectly!!

Thanks Regards
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes