Tuesday, October 06, 2009

Nerdvana Moment Of The Day


Copy this to a batch file and run it:

@echo off
setlocal enabledelayedexpansion

set Framefile=dosref.html
set TOCfile=TOC.html

echo ^<html^> >%Framefile%
echo ^<head^> >>%Framefile%
echo ^<title^>DOS Reference^</title^> >>%Framefile%
echo ^</head^> >>%Framefile%
echo ^<frameset cols="120,*"^> >>%Framefile%
echo ^<frame src="%TOCfile%"/^> >>%Framefile%
echo ^<frame name="showframe"/^> >>%Framefile%
echo ^</frameset^> >>%Framefile%
echo ^</html^> >>%Framefile%

echo ^<html^>^<head^> >%TOCfile%
echo ^<title^>Table of Contents^</title^> >>%TOCfile%
echo ^</head^>^<body^> >>%TOCfile%

for /f "usebackq skip=5 tokens=1" %%i in (`help ^|sort`) do (
if not exist %%i.txt (
help %%i > %%i.txt
if ERRORLEVEL 1 (
echo ^<a href="%%i.txt" target="showframe"^>%%i^</a^>^<br/^> >>%TOCfile%
) else (
del %%i.txt
)
)
)

echo ^</body^>^</html^> >>%TOCfile%
In case you're suspicious of running strange batch files you see on the internet (aka smart), what it does is create a frame-based DOS command html reference. Tested in Windows XP, Vista should work too.

6 comments:

  1. How do I copy it to a bat file? When I select the text & copy to notepad, it all runs together (no return chars)
    -Dad

    ReplyDelete
  2. I copied it from Chrome to Notepad and it worked. Did you try Wordpad?

    ReplyDelete
  3. I created it in Write, but it didn't work.

    ReplyDelete
  4. If you're still using Write, the batch script will not work, as it relies on DOS features that were invented some time after 1995.

    ReplyDelete
  5. (After checking) The problem lies with the browser. Firefox 3.5.1 and Chrome 3.0.195.21 both replace the <BR/> tags with CRLF when you copy text to the clipboard. IE 6 does not, and 7 & 8 may not either.

    ReplyDelete
  6. Copy & Paste into Word works. Then copy & paste into a bat file.
    Thanks! Neat.
    - Dad

    ReplyDelete

Note: Only a member of this blog may post a comment.

Current Earth-Destruction Status This page is Class A WWW Depricated

Lilypie Third Birthday tickers
Lilypie First Birthday tickers
All material on these pages is ©2003-2010 by Joe Belland, Dave Belland, Tom Adams, Cari Burud and/or Paul Harold except for the stuff that we blatantly stole from other sources. All rights reserved.