Menu Personal Support
from the mail box
Index
Index Trash



     I got to much post and I'm not able to answer all
     your questions! I made a decision today (March 6,
     2001). If a person ask me about support, then she
     must include her own not finished program/problem
     and if I finds a solution, then I'll upload it to
     this pages. So, I also decided to create this new
     section named Personal Support from the mail box.

 --> L. Lake. *.*.bak
     John R. M. Babiroussa. Use labels with some sence
     Marcus A. Kaptein.     ARGHHH! ugly ugly windows.
     Alexander Beauchamp.   DATE question from Atlanta
     Wayne Schrock.         Filename extraction
     Eric.                  Wanted an impossible space
     Sherwood               Copying from drive A to A.
     Aquiles                Off topic.






     Examples from my personal e-mail box. March 6, 01

     L. Lake wrote:
     I created this batch file that I have a short cut in my sendto folder
     so all I have to do is right click on a file and it created a backup
     file with a .bak extension ... it works very well for me (but at
     present anyone else who uses it cannot since it does not retain the
     original extension). But I would like it to have both extensions so
     the when I remove the .bat extension it will have its extension
     properites. Could you provide some assist or tell me how this can be
     done (where I went wrong)?

     if not exist c:\backup\nul md c:\backup
     if not exist c:\backup\data\nul md c:\backup\data
     :loop
     if %1!==! goto end
     copy %1 c:\myfiles\backup\*.*.bak
 ...[SNIP]

 I sent an answer to L. Lake yesterday (not included).
 Here goes a new answer from today which use of DEBUG:

 Hi L., here's a better and faster method but you must
 be careful because it cut probably short circuit your
 school teacher and about newbies, hmmm, don't show it
 to any newbies because they wouldn't be able to under
 stand this batch file so, they would simply screaming
 and running out of the door and then stumble but just
 use the below (it's better than my previours answer).

 @echo off
  if %1!==! goto END
  rem > %temp%\tmp_crlf.scr
  for %%d in (L102 W F100LFF''1A L W102 Q) do echo %%d >>%temp%\tmp_crlf.scr
  echo @xcopy %1 c:\backup\data\"> %temp%\tmp_bkup.bat
  debug %temp%\tmp_bkup.bat < %temp%\tmp_crlf.scr >nul
  copy %temp%\tmp_bkup.bat+nul %temp%\tmp_bkup.bat>nul
  dir /b %1 >> %temp%\tmp_bkup.bat
  debug %temp%\tmp_bkup.bat < %temp%\tmp_crlf.scr >nul
  copy %temp%\tmp_bkup.bat+nul %temp%\tmp_bkup.bat>nul
  echo ".bak>> %temp%\tmp_bkup.bat
  %comspec% /c %temp%\tmp_bkup.bat
  for %%f in (crlf.scr bkup.bat) do del %temp%\tmp_%%f
 :END

 :: If you don't like the above FOR loop, then you can
 :: write DEL %temp%\tmp_*.* or DEL %temp%\tmp_????.?*
 :: DEL %temp%\tmp_?*.??? blah blah, etc. ehhhm, BTW.:
 :: You can substitute the @XCOPY with COPY but if you
 :: do so, then you must includes the previours syntax
 :: about "IF NOT EXIST c:\folder\nul" blah blah, etc.
 :: You can also substitute the %comspec%/c with CALL.

 Benny, http://2dos.homepage.dk/batutil/SUPPORT.HTM#LL



@goto Errorlevel Using labels with sence. An example of a good label is a label named Down-Arrow, (in case this key was pressed). A label such as zY don't tell you anything. :Errorlevel @echo off choice /s/n/c'PKMH'0123456789abcdefghijklmnopqrstuvwxyz> nul if errorlevel 8 goto Errorlevel (Num or lowercase letter) if errorlevel 7 goto END ... (Escape (ASCII value 27)) :: Notis about the FOR loop: 76 characters per line, is a limit on my :: Homepage so, in order to work, you MUST substitute 3 with 00000003 :: and 4 with 00000004 -- Since the down-key-press gets an errorlevel :: value of 2, which is lowest, then it don't have to be in the below :: FOR loop. Moreover the below abbreviation Up-Arrow works without 5 :: that's because the word Up-Arrow equals exact this level as it is: FOR %%v in (Left-Arrow3 Right-Arrow4 Up-Arrow) do IF errorlevel %%v goto %%v :Down-Arrow ^ if errorlevel 3 echo. OOPS. Hit the Esc key, substitute 3 and 4 as described for %%v in (echo goto) do %%v Errorlevel 2, (down). :Left-Arrow for %%v in (echo goto) do %%v Errorlevel 3, (left). :Right-Arrow for %%v in (echo goto) do %%v Errorlevel 4, (right). :Up-Arrow for %%v in (echo goto) do %%v Errorlevel 5, (up). :END cls

From: "Marcus A. Kaptein"
Sent: Tuesday, May 22, 2001 7:07 PM
Subject: Creating a real-time program in MS-DOS

   Hi there.

   Thirst of all I want to give you a compliment about
   your homepage. It's very handy for me.

   Second of all I have a question.

   I'm a distributor of computers in Holland and I'm
   building lots of computers (about 20 a day) and I also
   install these PC's with all kinds of Windows.

   Therefor I created a DOS-menu where you can format,
   partition and install the harddrive and even test the
   harddrive.

   But it's in an ugly DOS-screen and I want it to make
   more beautiful, like a Windows-screen (not that that's
   beautiful, but you can use more then 16 colors...).

   Do you have a suggestion where I can find such a
   program to create this, or do you have a suggestion of
   how to create this yourself?

   Every suggestions is needed...

   Yours sincerelly,

   Marcus A. Kaptein
   Holland

   Hi Marcus,

   @echo off >%temp%.\~c.scr
   for %%v in (fB800:0LFA0''20''AD q) do echo %%v>>%temp%.\~c.scr
   debug <%temp%.\~c.scr>nul
   echo.
   echo. Hello World!

   The color code in this example is "AD".
   There's 16 colors, (0 1 2 3 4 5 6 7 8 9 A B C D E F).
   The first digit is for the background and the second is for the text,

           FF is white background and white text.
           F0 is white background and black text.
           07 is black background.

   The below batch file is useful for searching the color code.

   Benny, PS. Line number 15 contents an ASCII 27 character and
              line number 16 contents an ASCII 04 character as:

                    choice /n/...  PKMH<ASCII 27> Use the Arrow
                    for %%v in...  Up-Arrow Esc<ASCII 4>) do if

   By doing so, the below batch file would be 1.024 bytes long.
   (If it's not this filesize, then the two lines got WRAPPED:)

@echo off
if exist %0.bat %0.bat
find "@% % " <  %0 > %temp%.\~c#.bat
for %%v in (set goto:#) do %%v color=AD
@ echo h%3 %4>%temp%.\~c.bat
@ echo q>>%temp%.\~c.bat
@ debug < %temp%.\~c.bat | find "-" /v >%temp%.\~c.bat
@ for %%v in (rcx B eFB'set'9'%%1'3D e104''D''A wFB q) do echo %%v>>%temp%.\
UNWRAP HERE
~c.bat
@ type %temp%.\~c.bat | debug %temp%.\~c.bat >nul
@ call %temp%.\~c %1
:#
rem >%temp%.\~c.scr
for %%v in (fB800:B0L80'@'%color% q) do echo %%v>>%temp%.\~c.scr
debug <%temp%.\~c.scr
choice /n/s/c'PKMH Use the Arrow keys or hit Esc key to quit. % %
for %%v in (Left-Arrow00000003 Right-Arrow00000004 Up-Arrow Esc) do if erro
UNWRAP HERE
rlevel %%v goto %%v
for %%v in (call cls goto:#) do %%v %temp%.\~c# color =add %color% FFF0
:Left-Arrow
for %%v in (call cls goto:#) do %%v %temp%.\~c# color =add %color% FFFF
:Right-Arrow
for %%v in (call cls goto:#) do %%v %temp%.\~c# color =add %color% 1
:Up-Arrow
for %%v in (call cls goto:#) do %%v %temp%.\~c# color =add %color% 10
:Esc
set color=
del %temp%.\~c*.*


   Notes and modifications:
   Remove the "cls " in the above 4 lines.
   Substititute the "rem >%temp%.\~c.scr" with "mode co80>%temp%.\~c.scr"

   Substitute the 2 lines (starting with CHOICE and FOR)
   with the following 3 lines:
   choice /n/cGPKMHRO Use the Arrow keys or press End key to quit. % %
   for %%v in (2 3 4 5 6 7) do if errorlevel %%v goto %%v
   %0 Home

   New label names:
   :2 Down
   :3 Left
   :4 Right
   :5 Up
   :6 Insert
   :7 End or Esc

   The following is for the Insert option, (4 wrapped lines):
   echo fB800:3CAL14'I'1F'n'2F's'3F'e'4F'r'5F't'6F'ÿ'07't'70'w'8F'o'9F> %tem
p%.\~c.scr
   for %%v in (fB800:516L0C'd'A0'i'B0'g'CF'i'DF't'E0's'F0 q) do echo %%v>>%t
emp%.\~c.scr
   debug <%temp%.\~c.scr>nul
   for %%v in (1 2 3 4 5 6) do echo.
   choice /n/c'0123456789'''''''ABCDEF > nul
   for %%v in (0 1 2 3 4 5 6 7 8 9 A B C D E F) do if errorlevel }%%v set co
lor=%%v
   choice /n/c'0123456789'''''''ABCDEF %color%
   for %%v in (0 1 2 3 4 5 6 7 8 9 A B C D E F) do if errorlevel }%%v set co
lor=%color%%%v
   goto:#


   Okay, the following batch isn't finished and should be updated
   and tested but it works. The above batch file at the month was
   created based on the below. "AD" is the same as 42m with ANSI.
   Notis about the below lines: A prefix of 3 spaces in the front
   of a line is a line which isn't wrapped.

   Benny, PS. the #.BAT file is here:
   http://users.cybercity.dk/~bse26236/batutil/GARBAGE.HTM#sub

   @echo off > %temp%.\~.bat
   rem       > %temp%.\~.scr
   for %%v in (0 A 14 1E 28 32 3C 46 50 5A 64 6E 78 82 8C 96 A0 AA B4 BE C8 
D2 DC E6 F0) do echo.@set %%1=%%v0>> %temp%.\~.bat
   for %%v in (f100L4''9 w q) do echo %%v>> %temp%.\~.scr
   set  %{ Line number, [1;25] ......... }%  s=%1
   set  %{ Start position, [1;80] ...... }%  p=%2
   set  %{ Length, [1;2000] ............ }%  L=%3
   if %s%'==' set s=2
   if %p%'==' set p=9
   call #  p hex = dec2hex(  %p%  )dec
   if %L%'==' call #  c1 hex = sub(  52 %p%  )hex
   if %L%'==' call #  c1 hex = sub( %c1% %p% )hex
   if %L%'==' call #  c1 dec = hex2dec( %c1% )hex
   if %L%'==' set  L=%c1%
   find ""/v/n < %temp%.\~.bat | find "[%s%]" > %temp%.\~.bat
   debug %temp%.\~.bat < %temp%.\~.scr > nul
   call  %temp%.\~ s
   call #  L hex = dec2hex(  %L%  )dec
   call #  s hex = add(  %s% %p%  )hex
   call #  s hex = add(  %s% %p%  )hex
   call #  s hex = add(  %s% FFFE )hex, btw. same as: sub( %s% 2 )
   call #  L hex = add(  %L% %L%  )hex
   set color=009D
   :#
   call #  c (1...4) = 2env( %color% )string
   set color=%c3%%c4%
   rem > %temp%.\~.scr
   for %%v in (fB800:%s%L%L%''40''%color% q) do echo %%v>> %temp%.\~.scr
   cls
   debug < %temp%.\~.scr
   choice /s /n /c'PKMH''''''''''''''''''''''''''''' Use the Arrow keys - H
it Esc key to quit % %
   for %%v in (Left-Arrow00000003 Right-Arrow00000004 Up-Arrow Esc!) do if e
rrorlevel %%v goto %%v
   :Down-Arrow
   for %%v in (call goto:) do %%v #  color hex = sub(  %color% 10  )hex
   :Left-Arrow
   for %%v in (call goto:) do %%v #  color hex = sub(  %color% 01  )hex
   :Right-Arrow
   for %%v in (call goto:) do %%v #  color hex = add(  %color% 01  )hex
   :Up-Arrow
   for %%v in (call goto:) do %%v #  color hex = add(  %color% 10  )hex
   :Esc!
   cls
   for %%v in (. .fB800:%s%L%L%''20''%color% .q) do echo%%v
   for %%v in (s p L color c1 c2 c3 c4) do set %%v=
   for %%v in (bat scr) do del %temp%.\~.%%v


Greetings!

I'm trying to create a DOS batch file that will create a directory named
with today's date (For Example, '06-12-2001').  Can you help?  I am
completely new to DOS and would appreciate any pointers you could provide.

Thanks in advance!
Alex, Accenture - Atlanta

This was really not a rare question. Commonplace so, to not be
bored, I have to include something else into the answer. Hmmm,
Okay, what about a colon which reduces a loop with SHIFT, some
few EXPLORER switches along with my new & very brief loop: FOR
%%v in (L2 f0L2''9 w0 q)... which removes the CRLF with DEBUG.

The following batch file created a file named like 14-06-2001.
To create a directory instead, use: IF NOT EXIST %1\NUL MD %1.
Benny, PS. Here's your file:

@echo off %[ http://users.cybercity.dk/~bse26236/ ]%> %temp%.\~d.bat
if not '==%1' goto Loop
if exist %0.bat %0.bat;
echo;%0:>%temp%.\~c.bat
::     ^ this colon (:) removes %1 (like shift). To include %1, just
::     ^ substitute the colon with a semicolon (;) (or a space ( )).
for %%v in (L2 f0L2''9 w0 q) do echo.%%v>> %temp%.\~d.bat
debug %temp%.\~c.bat < %temp%.\~d.bat >nul
echo. | date>> %temp%.\~c.bat
%temp%.\~c.bat
:Loop
shift
echo. %1 | find "2" > nul
if errorlevel 1 goto Loop
erase %temp%.\~?.b*
rem>>%temp%.\%1.txt
echo %temp%.\%1.txt
if exist %windir%.\explorer.exe explorer/e,./root,,/select,%temp%.\%1.txt
::    When you click the right window, the file would be selected.
::    To display any contents of the file, just remove the /root,,


Filename extraction

  Wayne Schrock wrote:

  First let me say, I have enjoyed your web site very much.
  I have a small problem I don't know how to solve.

  Would you please be kind enough to help?

  I have a batch file that is being passed a parameter that is a path and
  filename together. I need to extract the filename by itself to another
  parameter.

  Thanks in advance.

  Wayne Schrock, R&D Tool and Engineering, <http://www.rdtool.com/>

  Hi,
  I got many e-mails each day and I don't have time but I also wanted to
  find a solution for your question. Hmmm -- maybe something like this?:

  @echo off %{ Remember before first run to unwrap lines: 3, 4 and 7: }%
  set test=c:\blah\blah\blah\blah\blah\blah\blah\blah\blah\blah\NAME.EXT
  %[ 03 ]% echo exit|%comspec%/kprompt f0L50 0$_e0'\%test%'$_s0L50'\'$_q|deb
ug|SORT/R>%temp%.\~.bat
  %[ 04 ]% echo exit|%comspec%/kprompt e100' set x='$_e10C 1A$_w$_q|debug %t
emp%.\~.bat>nul
  call %temp%.\~.bat
  echo set x=%test%>%temp%.\~.bat
  %[ 07 ]% echo exit|%comspec%/kprompt fFAL50 1A$_LFA$_M1%x%L50 100$_wFA$_q|
debug %temp%.\~.bat>nul
  for %%v in (call del) do %%v %temp%.\~.bat
  ::
  :: The contents of the variable Test can't be many kilometres long but
  :: "c:\windows\desktop\blah\blah\blah\blah\blah\blah\blah\bigName.EXT"
  :: shouldn't be a problem. Anyhow, in the example above are quotes so,
  :: you may want to get rid of a single quote (if it's a problem), just
  :: try to remove the prefixed double colons in front of the below FOR:
  ::FOR %%v in (%x%") do SET x=%%v
  ECHO (Test) = (%test%)
  ECHO (x)    = (%x%)
  for %%v in (test x) do set %%v=

  Notes: The command SORT /R would sort all/any hex numbers in a reverse
         order so, there's no need for a command such as FIND "-"/V etc.


Impossible Space

  Eric wrote:
  hey i was just looking over your site.. informative..but
  i still need what im looking for and was wondering if you
  could help.. i need to find out how to put a space in a
  filename in dos...... cause it doesnt allow you spaces..

  I'm not able to answer the 10 questions that I got each day
  and a solution here is not possible, so, I will answer your
  question anyway:

  @echo off
  echo.exit '|%comspec%/kprompt f0Lff 9$_e0'ren> %temp%.\~.bat
  REM -->> C:\COMPUT.TXT
  echo e3' C:\COMPUT.TXT COM'ff'PUT.TXT 'd a 1a>>%temp%.\~.bat
  ::       ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
  for %%1 in (w0 q) do echo %%1>>%temp%.\~.bat
  type %temp%.\~.bat | debug.exe %temp%.\~.bat > nul
  for %%1 in (call erase) do %%1 %temp%.\~.bat


Copying from drive A to A

This is one of the BEST site I have seen for this type help!
All of the others have no where near as much details or
examples....Thank you for sure!
That being said...
I have looked hi and lo and never do I see:
how does one copy a file from a floppy in drive a: to another floppy
in drive a: (because one only has one floppy drive ")(Except that it
can be done with diskcopy as I saw on your site LOL)
How is this done using copy or xcopy or can it be done?(I hope you
know ")) I KNOW it can be done because I used to do it years ago
(I think anyway)when DOS was a much more widely used device...but alas
I have forgotten the exact syntax :(...at least I think I used to do
it...maybe I used diskcopy then also??

Anyway  Thanks again and I hope you can help
Sherwood
-------------

:: A2A.BAT;  The fastest way that I could figure out about copying a
:: data file between two floppy disks. March 2002 by Benny Pedersen:
::
IF drag&drop(%1)==drag&drop() Goto press Alt-F4 to close.
CLS
@ECHO off
ECHO Wait until you see the message of the write protected source
ECHO disk: "Try Again", then insert the destination disk in drive A:
%COMSPEC%/cFOR %%c in (w q) do ECHO %%c|debug %1>NUL
CLS
:press


More from my personal e-mail box. June 5, 2002. Change of ownership. An old man senior is gone but he left over the shop to a yonger man who now taker.

     Yesterday, I got a WinXP, so, I havn't any
     time to write more on this page,     .
                                         / \
                                       _/___\_
                                      [CLOSED.]
Hi Mrs. Pedersen, how r u ? My name is Aquiles, i'm a 21 years old man
living in Brazil, and im interested in your work.Well first of all its
amazing what u did, what u do and what u r going to do. I'll be honest
with u i got a little confused with the quantity of information your
site have. I love computers, but for me they r just a hobbie, and my
objective now with then is to discover there soul how do the operanting
system work and lots of advanced stuff, but sincirily i dont know how
to do it. Actually i have 2 XT's processor 8088 to try enabling my
experience, and im trying to discover how win98 win31 and winxp works
to change them and make them work like i would like they to work.i have
the win 1.01 version but it doenst works and i dont know why. And i
love the 70's and 80's computers tecnology. If u could help me to find
the computer soul i would be really glad.

Sincirily yours,        Aquiles Dante Costa Mônaco Filho


Don't get confused with the quantity of information. Some of it isn't
any good and some of it was uniq (that was what I heard). I also have
some old computers but I normally just turn on my newest one, which's
a little 450 MHZ with 256 MB RAM. That big enough for what I'm doing.

I found the soul but it toke some time. I can't say what other should
do to find it except one thing, namely to remember to never forget an
important message: Man created the computer but God invented the man.
That is the secret about it and once the soul is found, you'll master
even the hard stuff just like Jesus did.

Benny Pedersen, http://2dos.homepage.dk/
PS.
I'll still construct batch in the future but including VBS Solutions.
Those solutions would be compatible with WinXP which got a nice look.


-Top- Trash