Quantcast
Channel: Total Commander
Viewing all articles
Browse latest Browse all 18767

Eng :: RE: How to put a FOR loop command on the button bar?

$
0
0
Author: Stefan2
Subject: DOS Batch: send empty new line to file
Posted: Tue Apr 12, 2016 1:02 am (GMT -6)

I know that is coming Very Happy

Just double the command and concatenate them by an ampersand sign '&'
To send an empty line, utilize ECHO+Dot: ECHO.

FOR /F "tokens=*" %%A IN ('TYPE "%F"') do @ECHO.  >> "%%A" & ECHO %%~nxA >> "%%A"


But that works only if there is already a trailing line break in your files.
If your files end with the last line of text (and no line break), there will be no empty line added.
So maybe double that empty line command?:
FOR /F "tokens=*" %%A IN ('TYPE "%F"') do @ECHO. >> "%%A" &ECHO. >> "%%A" & ECHO %%~nxA >> "%%A"


And as Dalai always says: use quotes, just in case your file names contains spaces: "%%A" ....instead of.... %%A




If you need something more reliable, use VBScript or PowerShell

 
_________________
MfG, Stefan
WinXP-10, 32+64-Bit
Am Anfang war das Wort... Darum: Wehret den Anfängen. Kein Viertes Reich! - (☪ oe is †) = ☮


Viewing all articles
Browse latest Browse all 18767

Trending Articles