Stupid batch file question

Sharky Forums


Results 1 to 8 of 8

Thread: Stupid batch file question

  1. #1
    Great White Shark Un4given's Avatar
    Join Date
    Oct 2000
    Location
    Salt Lake City, UT United States
    Posts
    22,553

    Stupid batch file question

    I know this sounds stupid, but here it goes. I've written a batch file that copies my working Outlook and archive PST files to a location on another hard drive for redundancy purposes. The batch file works fine, but there is something odd about the text during execution. I have a REM command with a brief description of what the batch file does, and a pause command that makes the batch file wait for a key to be pressed for execution. Now here is where it gets odd. The REM and pause command are showing up in the command window as text.

    I wrote it in Notepad. It's not rich text, just a plain old text file. Any idea why these are showing up as text when the batch file is executed? I'm guess it's do to the way the command prompt is handled in Windows 7, but thought I'd ask.

    OS: Windows 7 64-bit
    Prince of the OC Crusaders

    Intel i7 3.2GHz @ 4.24GHz
    Cooler Master V8
    Asus P9X79 Pro
    16GB Patriot Viper Extreme DDR3-1600 (quad channel)
    HIS R9 290X @1050MHz
    Asus 20x DVD-RW DL DVD-RW

  2. #2
    Administrator Steve R Jones's Avatar
    Join Date
    Oct 2000
    Location
    Largo, FL.
    Posts
    5,460
    Sounds normal to me.

    Create a line after the REM command-> CLS (clear screen)
    "Vegetarians live up to nine years longer than the rest of us...Nine horrible, worthless, baconless years."

  3. #3
    Great White Shark Wurm's Avatar
    Join Date
    Feb 2001
    Location
    Grafenwöhr / Deutschland
    Posts
    10,757
    I agree that it sounds normal

    I wouldn't even bother with the CLS command if the *.bat is working correctly.

    Unless the text is really really bothering you
    War... War never changes.

  4. #4

  5. #5
    Great White Shark
    Join Date
    Nov 2000
    Location
    Alpharetta, Denial, Only certain songs.
    Posts
    9,925
    Quote Originally Posted by SpywareDr View Post
    Insert an:
    @echo off
    as the very first line in your batch file.
    What he said.

    @echo off is what keeps the rem lines from showing up.

    Crusader for the 64-bit Era.
    New Rule: 2GB per core, minimum.

    Intel i7-9700K | Asrock Z390 Phantom Gaming ITX | Samsung 970 Evo 2TB SSD
    64GB DDR4-2666 Samsung | EVGA RTX 2070 Black edition
    Fractal Arc Midi |Seasonic X650 PSU | Klipsch ProMedia 5.1 Ultra | Windows 10 Pro x64

  6. #6
    Goldfish
    Join Date
    Nov 2012
    Location
    Maryland, USA
    Posts
    77
    When you run a batch program, each of the batch program's commands are typically displayed (echoed) on the screen. You can toggle this feature on or off by using the ECHO command. (ECHO [ON|OFF])

    Inserting an at sign (@) in front of a command in a batch program prevents that one line from being echoed to the screen.

    The command "echo off" would turn off echoing any further commands to the screen but, you would still see those two words, "echo off", on the screen.

    So to get around that, simply add an "@" prefix . . . "@echo off".

  7. #7
    Great White Shark Un4given's Avatar
    Join Date
    Oct 2000
    Location
    Salt Lake City, UT United States
    Posts
    22,553
    OK, thanks guys. I'll give that try.
    Prince of the OC Crusaders

    Intel i7 3.2GHz @ 4.24GHz
    Cooler Master V8
    Asus P9X79 Pro
    16GB Patriot Viper Extreme DDR3-1600 (quad channel)
    HIS R9 290X @1050MHz
    Asus 20x DVD-RW DL DVD-RW

  8. #8

Posting Permissions

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