|
CrLf
|
|
CrLf -- Tested in Win98.
CrLf: Carriage return + Line feed. ASCII value 10 and 13, D A (Hex).
Batch files
Win9X
Universal Prefix file with no final CrLf
Version 1: (File size minus two, (E107' 2'...))
GOTO 0 Removes the last two bytes from a file named ABC.
RCX
1
Q
E100'RCX'D A
W
Q
E100' H'
E107' 2'D A'Q'D A
RCX
D
W
Q
: 0
If not exist %0 %0.bat
DEBUG ABC <%0 | FIND "CX " | FIND /V "^" > %TMP%.\#
FIND " " < %0 | DEBUG %TMP%.\#
DEBUG < %TMP%.\# | FIND /V "-"> %TMP%.\##
FIND " " < %0 | DEBUG %TMP%.\##
FOR %%I IN (W Q) DO ECHO. %%I>> %TMP%.\##
DEBUG ABC < %TMP%.\##
DEL %TMP%.\#
DEL %TMP%.\##
Ver 2: (alternative simple sub routine technique by a variable named Next)
@ GOTO 0
L102
E100''D''A
W100
Q1
: Debugs
DEBUG %FILE% < %0 > NUL
FOR %%I IN (SET GoTo:%Next%) DO %%I Next=
: 0
@ ECHO OFF
If not exist %0 %0.bat
Set File=ABC
REM Create File
ECHO FirstName> %File%
SET Next=1
GoTo Debugs
: 1
ECHO. LastName>>%File%
ECHO.
ECHO. Result:
TYPE %File%
ECHO.
DEL /P %FILE%
SET File=
PAUSE
CLS
Ver 3: (most similar the above ver 2 but with fewer lines)
@REM>> ABC
@ECHO EXIT|%COMSPEC% /KPROMPT L2$_E0 D A$_W0$_Q|DEBUG>NUL ABC
CLS
@ECHO. Removed prefixed CrLf.>> ABC
@TYPE ABC
PAUSE
|
|
|