Manually Creating Line Fragments


A line fragment is a text line without the terminating CR/LF. Line fragments may be added to the beginning of regular lines to create a new longer line. 

Creating a line fragment ahead of time is immensely popular. This is a "Make it once and use it forever" kind of thing. Once you have a line fragment, you can concatenate it with another line to join the two into a new (batch file!) single line. It's as simple as using COPY:
copy fragment.txt + someline.txt newline.bat

Example using NotepadThe easiest "ahead of time" technique is to use any decent word processor to create your fragment. In the picture shown here, I'm creating a fragment that says SET VALUE=. You could just as easily have it specify another batch file. No matter. The trick is to leave your cursor (shown as a vertical bar in this example) at the end of the line. Absolutely don't hit "Enter". In fact, hit the "Delete" key a few times just to make sure there are no invisible carriage returns. If you hit your right arrow key, your cursor shouldn't move. If you're there, all you have to do is save what you have as plain text (which is all Notepad can do anyway).
 

Example using COPY CONDOS diehards (that's you, right?) will prefer to create the fragment ahead of time using DOS. We can do it by copying the console (the keyboard) into a file. Of course, we can't hit the "Enter" key at the end of the line (bet you guessed that). Instead, hit ctrl-z (hold the "Ctrl" key down, then hit the "z" key). After that you can hit the Enter key. That's all there is to it.

Example using EDITMost people think it can't be done with EDIT, but it can! You see, EDIT has an anoying habit of appending a carriage-return / linefeed pair to every file it saves. No stopping it. But just like doing it from the DOS prompt, the trick is to get a control-z into the file. Control-z characters are (were) used to mark the end of a file. Sticking one in with EDIT is a deeply-buried trick. First you have to hit Ctrl-p. That turns on a software switch which allows you to enter a single control character in the file. You can then enter your control-z one of two ways: Either hold down the "Ctrl" key and hit "z" --or-- hold down the "Alt" key while entering "026" on the numeric keypad. If it works, you'll see the cool little right arrow.

Lost? Look at the site map.

Bad links? Questions? Send me mail.

Google
Yahoo
Ask Jeeves