Computing.Net > Forums > Programming > Echo blank line from batch file

Echo blank line from batch file

Reply to Message Icon

Original Message
Name: esokol
Date: December 26, 2005 at 16:09:31 Pacific
Subject: Echo blank line from batch file
OS: NT/XP
CPU/Ram: enough
Comment:

I have tried using echo. (echo followed by period) to create a blank
line. I get the error:
'echo.' is not recognized as an internal or external command,
operable program or batch file.


Any ideas/suggestions would be helpful.
Thanks in advance.


Here is the bat file:
@echo off
REM HNACP00012012
if "%1"=="" goto usage
if "%2"=="" goto usage
if "%3"=="" goto usage
for /f "skip=1 delims=" %%a in ('DIR "%~1\%~2*.%3" /A-D /O-D /B /TW')
do ECHO %1\%%a
for /f "skip=1 delims=" %%a in ('DIR "%~1\%~2*.%3" /A-D /O-D /B /TW')
do del "%1\%%a"
goto xit
:usage
echo Usage: %0 directory fileprefix fileextension
echo.
echo This will change to the specified directory.
echo It will delete all files named fileprefix*.fileextension except
the one last written to.
echo.
echo Example: %0 c:\INFOSTAT\temp HISRpt txt
echo.
echo This will delete all files named HISRpt*.txt in the
c:\INFOSTAT\temp directory
echo except the one with the latest write date.
:xit


Here is what I get when I issue the command: CleanAllButLast


Usage: CleanAllButLast.bat directory fileprefix fileextension
'echo.' is not recognized as an internal or external command,
operable program or batch file.
This will change to the specified directory.
It will delete all files named fileprefix*.fileextension except the one
last wri
tten to.
'echo.' is not recognized as an internal or external command,
operable program or batch file.
Example: CleanAllButLast.bat c:\INFOSTAT\temp HISRpt txt
'echo.' is not recognized as an internal or external command,
operable program or batch file.
This will delete all files named HISRpt*.txt in the c:\INFOSTAT\temp
directory
except the one with the latest write date.


Report Offensive Message For Removal

Response Number 1
Name: IVO
Date: December 27, 2005 at 09:53:01 Pacific
Subject: Echo blank line from batch file
Reply: (edit)

Do you ger the error message under Windows NT, XP or both systems?

You posted NT and XP as your running environments and sometime NT is rich of astounding behaviors.


Report Offensive Follow Up For Removal

Response Number 2
Name: IVO
Date: December 27, 2005 at 12:29:04 Pacific
Subject: Echo blank line from batch file
Reply: (edit)

Anyway the following acts exactly as Echo. does

Ver | Find /V "er"

and may be used to work around the trouble.


Report Offensive Follow Up For Removal

Response Number 3
Name: esokol
Date: December 28, 2005 at 07:44:59 Pacific
Subject: Echo blank line from batch file
Reply: (edit)

Thanks for the replies. I actually tested the file on XP.
I had also posted my issue to the alt.msdos.batch group (should have been to alt.msdos.batch.nt group). In the alt.msdos.batch.nt group I found that the problem was I had a file named "echo" (don't know why) in the same directory as my bat file. Removing that file caused the echo. (echo followed by period) to work correctly.
Additionally, I found if I used echo, (echo followed by comma) that I got a blank line even if I had the "echo" file present in the same directory.


Report Offensive Follow Up For Removal

Response Number 4
Name: twilightsentry
Date: December 31, 2005 at 13:55:37 Pacific
Subject: Echo blank line from batch file
Reply: (edit)

Try 'echo:' or 'echo|'

I can't remember which one it is...


Report Offensive Follow Up For Removal

Response Number 5
Name: FBI Agent
Date: January 10, 2006 at 19:28:28 Pacific
Subject: Echo blank line from batch file
Reply: (edit)

i dont know c++ but cant you just use \n on the end of the previous line?

example:

echo Usage: %0 directory fileprefix fileextension\n

instead of

echo Usage: %0 directory fileprefix fileextension
echo.

sorry if it doesnt help you but it just seems familiar.

FBI Agent

AIM: EliteAssassin187


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Echo blank line from batch file

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software