Results 1 to 12 of 12
  1. #1
    Star Lounger
    Join Date
    Sep 2003
    Location
    Betekom, Belgium
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    dos6.22 - hooked

    hi,

    i found this piece of code but somehow it doesn't work. Why??

    @echo off
    :: This batch file allows you to run programs on certain days.
    :: Have this TODAY.BAT program CALLed from your AUTOEXEC.BAT.
    :: TODAY.BAT will read entries in a TODAY.INI file you must make.
    :: The entries in the TODAY.INI should look like this:
    :: 10-12-1999=DeleteOldDocs.bat
    :: 10-13-1999=Scandisk.bat
    :: 10-14-1999=PrintReports.bat

    :: Put the date into the DATE environment variable
    :: Response to DATE command should be like
    :: Current date is Sun 10-12-1997
    :: Enter new date (mm-dd-yy):
    @echo.|date|find /i "current">#urrent.bat
    @echo set date=%%4>current.bat
    call #urrent.bat
    del ?urrent.bat

    :: Put the command for today into TODAYSCOMMAND variable
    :: Assumes existence of TODAY.INI in current directory
    find "date%=" today.ini | sort /r | date | find "=" > en#er.bat rem here things get lost somewhere
    @echo set todayscommand=%%5> enter.bat
    call en#er.bat
    del en?er.bat > nul

    :: Cleanup - delete DATE variable and INI entry (so it only runs once)
    type today.ini|find /v "

  2. #2
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: dos6.22 - hooked

    The problem probably lies here:<pre>:: Response to DATE command should be like
    :: Current date is Sun 10-12-1997
    :: Enter new date (mm-dd-yy):</pre>

    In XP the response given by the DATE command (and other date and time commands) varies significantly according to your regional and language options. See my attachment for boring details!

    In a Command Prompt window, type DATE /T and see what you get.
    I suspect you will need to change the line
    @echo set date=%%4>current.bat
    to
    @echo set date=%%3>current.bat

    The same applies later down, with the 5 parameter...

    And there is a predefined variable %date% in XP, which might cause problems, too...

    I would say that even for DOS 6.22 the coding style is pretty nasty, and in XP it could be made a whole lot simpler and more intelligible...!

    John

    PS If you were to say what you actually wanted to achieve, it would be better to start from scratch using today's BATch technology!
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  3. #3
    Star Lounger
    Join Date
    Sep 2003
    Location
    Betekom, Belgium
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: dos6.22 - hooked

    Hello John,

    I am trying to run this code on a pure dos6.22 machine.
    but in answer to the file where it is supported to read the command it has to carry our on that date nothing happens.

    Why on earth am I getting back to dos?
    At the moment I am having a course on Pc technics and dos is a starting point.
    I want to understand the use of the commands and this one I like as a replacement of a taskmanager in dos6.22.
    Still it gets me when things don't work as they should do.

    Any further idea's?

  4. #4
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: dos6.22 - hooked

    OK, at the DOS prompt type DATE and tell me what you get given. We need to start from there!

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  5. #5
    Star Lounger
    Join Date
    Sep 2003
    Location
    Betekom, Belgium
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: dos6.22 - hooked

    John,

    thanks for helping me out in this on this one
    it reads "Current date is Sun 28/05/2006" which also appears in #urrent.bat
    current.bat reads "set date=%4"
    enter.bat reads "set todayscommand=%5"
    en#ter.bat reads blank file


    when running the file i get a syntax error after set todayscommand

    I remarked the lines 17 24 27 28 so I could see what's in these files after running the code
    my todays.ini reads "28/05/2003=tester.bat"

    the only difference i see is the use of " / " instead of " - " into the date notation


    any ideas ?

  6. #6
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: dos6.22 - hooked

    Here's something I've had to bodge to work in Windows XP, which I hope will transfer to MS-DOS 6.22.
    Every command I've used for testing has the first word in CAPITALS. Delete those lines once you're happy with your tests.
    Your date formats in the INI file must match the dd/mm/yyyy format you get from the DATE command, of course!
    <pre>@echo off

    @ECHO .off

    ECHO 28/05/2006=$DUMMY.BAT>TODAY.INI

    ECHO @echo.>$DUMMY.BAT
    ECHO @echo Hello. >$DUMMY.BAT
    ECHO @echo Hello..>>$DUMMY.BAT
    ECHO @echo Hello...>>$DUMMY.BAT
    ECHO @echo and welcome from $DUMMY.BAT!>>$DUMMY.BAT
    ECHO @echo.>>$DUMMY.BAT
    ECHO @pause>>$DUMMY.BAT


    :: This batch file allows you to run programs on certain days.
    :: Have this TODAY.BAT program CALLed from your AUTOEXEC.BAT.
    :: TODAY.BAT will read entries in a TODAY.INI file you must make.
    :: The entries in the TODAY.INI should look like this:
    :: 12/05/2006=DeleteOldDocs.bat
    :: 13/05/2006=Scandisk.bat
    :: 14/05/2006=PrintReports.bat

    :: Put the date into the DATE environment variable
    :: Response to DATE command should be like
    :: Current date is Sun 28/05/2006
    :: Enter new date (dd-mm-yy):
    echo.|date|find /i "current">#urrent.bat

    :: I need to replace the file in testing because of Windows XP differences! John Gray
    ECHO Current date is Sun 28/05/2006>#urrent.bat

    echo set date=%%4>current.bat
    TYPE #URRENT.BAT
    TYPE CURRENT.BAT
    PAUSE
    call #urrent.bat
    del ?urrent.bat

    :: Put the command for today into TODAYSCOMMAND variable
    :: Assumes existence of TODAY.INI in current directory
    find "%date%=" today.ini | sort /r | date | find "=" > en#er.bat
    echo set todayscommand=%%6> enter.bat
    :: originally this was %%5 John Gray

    FIND "%date%=" today.ini
    TYPE EN#ER.BAT
    TYPE ENTER.BAT
    PAUSE

    call en#er.bat
    del en?er.bat > nul

    :: Cleanup - delete DATE variable and INI entry (so it only runs once)
    type today.ini|find /v "%date%">today.ini
    set date=

    CLS
    :: Run today's command
    call %todayscommand%
    set todayscommand=</pre>

    Hope it will work!

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  7. #7
    Star Lounger
    Join Date
    Sep 2003
    Location
    Betekom, Belgium
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: dos6.22 - hooked

    John,

    thanks for the support. I told you I was hooked by this thing, didn't I.
    Just copied your code into a dat-file and changed the today.ini accordingly to call upon $dummy.bat.
    even didn't have to do that as you had forseen it in the code

    Sorry to tell you but with the am result, zipp, nothing, nada, sh**

    It is supposed to work but it doesn't.
    No typing errors (copied)
    only started up in dos6.22 on two different pc's one containing only and only dos6.22
    it seems nothing gets into EN#ER.BAT as it keeps blank

    something with the echo set todayscommand=%%6> enter.bat
    or with the pc / dos6.22 itself ?

    I have no clue but it got me hooked

  8. #8
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: dos6.22 - hooked

    Jan

    The command at issue is undoubtedly
    find "%date%=" today.ini | sort /r | date | find "=" > en#er.bat

    Put the following in a BATch file, and see what results:

    SET DATE=28/05/2006 (to match what you have in TODAY.INI)
    find "%date%=" today.ini
    PAUSE
    find "%date%=" today.ini | sort /r
    PAUSE
    find "%date%=" today.ini | sort /r | date
    PAUSE
    find "%date%=" today.ini | sort /r | date | find "="
    PAUSE

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  9. #9
    Star Lounger
    Join Date
    Sep 2003
    Location
    Betekom, Belgium
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: dos6.22 - hooked

    John,

    correct me if wrong
    with the last find command the redirection of the output which is nothing gets into the en#er.bat

    so in todayscommand which should be the 6 th entry in en#ter.bat equals to nothing
    so no command ever is executed

    do correct me if i am wrong.

  10. #10
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: dos6.22 - hooked

    I fired up (joke! it staggered) an old Windows 98SE computer in MS-DOS mode, and tried the BATch file, finding that it works if you charge the %6 parameter back to %5

    See what you get!

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  11. #11
    Star Lounger
    Join Date
    Sep 2003
    Location
    Betekom, Belgium
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: dos6.22 - hooked

    John,

    this is embarressing but still no succes at my side.
    just copied al the code and changed the date into todays 29th and %5 for the todayscommand, nothing.
    run it from a subfolder "oefen" where all the depending files reside too.

    so if it runs at our side it has to be my pc, whatelse could it be?

  12. #12
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: dos6.22 - hooked

    I think if it doesn't work for you, you need to:

    * state exactly what you get from the Date command (including the "Enter" line)
    * use my code a few posts back to display successively what you get starting with the "FIND" command, then adding the SORT, then DATE ...

    There may be subtle differences between Windows 98 SE in MS-DOS mode and MS-DOS 6.22, in the function and results of the various commands.

    John

    PS I hope you think this effort is worth it!
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •