Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Batch File Programming

    Alright, I sense a bit of a novel here, but hopefully it's concise enough for you batch programmers to get the idea. Time to dust out the cobwebs in the brain with regards to Batch Files!!! <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15>

    Currently, I have three batch files. These are used to keep a personal log of when I log in, and when I log out at the end of the day.

    The first, bootlog.bat is executed from the autoexec.bat file, and contains the following code:
    <pre>call current.bat
    echo Login occured on
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  2. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Batch File Programming

    Hi Kel,

    The attached zip file contains two batch files, HHMMSS.BAT and GETTIME.BAT. Extract them to the same folder and run HHMMSS.BAT to get the time broken down into its HH, MM and SS.ss components. A bit more work could be done to break the SS.ss into its component parts, but since you said you only wanted the hour, the MM and SS.ss components are a bonus anyway.

    Note that this only works on systems with the CHOICE command, which wasn't included in older versions of DOS.

    Cheers
    Attached Files Attached Files
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  3. #3
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Batch File Programming

    Thanks for the Tip Macropod!

    The next problem, is how to force a shut-down? Any scheduled batch-file runs in a new MS-DOS window, which must be manually closed before the system can shut itself down...

    Thanks again!
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  4. #4
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Batch File Programming

    Can you create a .PIF file for the .BAT that specifies close on exit?

    StuartR

  5. #5
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Batch File Programming

    Hi Kel,

    Have you maybe you'd be better off doing this with VB script. Though I'm not overly familiar with it, I'd expect that you could have a VBS routine that updates your log file every time Windows starts. Likewise, another VBS routine attached to an icon on the desktop could be used to update the logfile again when it's used to shut the system down manually or, failing that, when the Task Scheduler kicks in to force a shut-down at the specified time.

    Food for thought?
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

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