Cramped Lines of Code

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
john924xps
Posts: 65
Joined: 08 Jun 2012 07:48

Cramped Lines of Code

#1 Post by john924xps » 26 Oct 2012 07:26

Through youtube, I came across a link to pastebin, which held the code of a batch program. When I use the copy function on pastebin into a notepad, and test it, the program works great, but the coding of the program becomes all cramped; all on one line... But when I manually copy it, and paste it, the lines of code are on their respective lines, but it pops up with an error everytime I run it... Help?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Cramped Lines of Code

#2 Post by foxidrive » 26 Oct 2012 08:42

Paste the two versions here - use code tags to avoid formatting problems please.

john924xps
Posts: 65
Joined: 08 Jun 2012 07:48

Re: Cramped Lines of Code

#3 Post by john924xps » 26 Oct 2012 23:15

I'll just post the pastebin link here. The code is extremely long...
http://pastebin.com/HAVciXK9

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Cramped Lines of Code

#4 Post by abc0502 » 27 Oct 2012 00:30

I selected the RAW paste data and copied it to a file and there is no problems.

Note: I used notepad++ to past the data to the file.

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: Cramped Lines of Code

#5 Post by Ed Dyreen » 27 Oct 2012 00:35

'
Go to that site, select copy to clipboard, save the file as in.TXT
run this file, save out.TXT as 'Space Invaders v 1.CMD', enjoy :wink:

LFtoCRLF.CMD

Code: Select all

@echo off &setlocal disableDelayedExpansion &title %~n0

set "$iFile=in.TXT"
set "$oFile=ou.TXT"

echo.¯ '%$iFile%'
type "%$iFile%" &echo.
echo.® '%$iFile%'

more "%$iFile%" > "%$oFile%"
echo.

echo.¯ '%$oFile%'
type "%$oFile%" &echo.
echo.® '%$oFile%'

pause
exit
Couldn't test it still recovering from a recent OS corruption/boot failure of XP eg: ( choice missing ) :(.

john924xps
Posts: 65
Joined: 08 Jun 2012 07:48

Re: Cramped Lines of Code

#6 Post by john924xps » 27 Oct 2012 00:59

Can you please explain this line of code to me?
echo.¯ '%$iFile%'
What is the purpose of that line after the echo.?

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: Cramped Lines of Code

#7 Post by Ed Dyreen » 27 Oct 2012 02:36

'
When I wrote it, I added visual feedback to get a quick visual of the file being converted, you can safely remove it.

Post Reply