Results 1 to 8 of 8
  1. #1
    New Lounger
    Join Date
    Mar 2015
    Posts
    2
    Thanks
    0
    Thanked 1 Time in 1 Post

    DOS batch file will not run

    Hi folks, this one has really got me stumped. I have been using DOS batch files over the last 20+ years to automate little tasks and have never had many issues, but this one is really strange.

    I'm on Windows 7 64 bit.

    I wrote a simple batch file (called go.bat) to rename a series of file names like this:

    ren m.500 m500.wav
    ren m.501 m501.wav

    etc, for about 200 files names.

    When I run the batchfile from a CMD window, I get the following response:

    C:\batch>go

    C:\batch>■r
    '■r' is not recognized as an internal or external command,
    operable program or batch file.


    I have looked at the file in notepad and I can't see any weired characters, can anyone shed any light on this?

  2. #2
    Silver Lounger RolandJS's Avatar
    Join Date
    Dec 2009
    Location
    Austin metro area TX USA
    Posts
    1,728
    Thanks
    95
    Thanked 127 Times in 124 Posts
    can you rename one file using a dos box in admin mode?
    there might be a problem in the way ren command is being looked at by cmd.exe
    "Take care of thy backups and thy restores shall take care of thee." Ben Franklin revisited.
    http://collegecafe.fr.yuku.com/forum...-Technologies/

  3. #3
    New Lounger
    Join Date
    Mar 2015
    Posts
    2
    Thanks
    0
    Thanked 1 Time in 1 Post
    Fixed!

    I ran the batch file though an online hidden-code stripper and it found some hidden chars.
    I thought notepad only handled basic text and would not be able to handle hidden chars, but it seems I was wrong.

  4. The Following User Says Thank You to tvr450 For This Useful Post:

    mrjimphelps (2015-03-10)

  5. #4
    Silver Lounger RolandJS's Avatar
    Join Date
    Dec 2009
    Location
    Austin metro area TX USA
    Posts
    1,728
    Thanks
    95
    Thanked 127 Times in 124 Posts
    thanks for the headsup! I'll remember that fact
    I use metapad for all my batchfiles; have you heard of metapad?
    "Take care of thy backups and thy restores shall take care of thee." Ben Franklin revisited.
    http://collegecafe.fr.yuku.com/forum...-Technologies/

  6. #5
    WS Lounge VIP Coochin's Avatar
    Join Date
    Jun 2014
    Location
    Queensland, Australia
    Posts
    2,153
    Thanks
    31
    Thanked 306 Times in 266 Posts
    Quote Originally Posted by tvr450 View Post
    ...I thought notepad only handled basic text and would not be able to handle hidden chars, but it seems I was wrong.
    As you discovered, Notepad might not display certain characters.

    For working with batch files, and other code files, I use Programmer's File Editor because it displays hidden characters.

    Note that the above link will load a Cnet download page. If you decide to download PFE watch out for any "extras" Cnet might have added. Untick checkboxes for extras, etc.
    Computer Consultant/Technician since 1998 (first PC was Atari 1040STE in 1988).
    Most common computing error is EBKAC: Error Between Keyboard And Chairback
    AMD FX8120 (8-core @ 3.1GHz) CPU, Gigabyte GA-990FXA-D3 motherboard, 8GB (2x4GB) DDR3 1866MHz RAM, ATI-AMD Radeon HD6770 PCI-E VGA, 480GB Kingston SSD, 2TB Seagate SATA3.0 HDD, ASUS DVD/RW.

  7. #6
    WS Lounge VIP mrjimphelps's Avatar
    Join Date
    Dec 2009
    Location
    USA
    Posts
    3,396
    Thanks
    445
    Thanked 404 Times in 376 Posts
    Quote Originally Posted by tvr450 View Post
    Fixed!

    I ran the batch file though an online hidden-code stripper and it found some hidden chars.
    I thought notepad only handled basic text and would not be able to handle hidden chars, but it seems I was wrong.
    I would suggest using EDIT (the old DOS text editor), but it seems to have disappeared from Windows 7.

  8. #7
    Silver Lounger RolandJS's Avatar
    Join Date
    Dec 2009
    Location
    Austin metro area TX USA
    Posts
    1,728
    Thanks
    95
    Thanked 127 Times in 124 Posts
    metapad or editplus are also good choices
    "Take care of thy backups and thy restores shall take care of thee." Ben Franklin revisited.
    http://collegecafe.fr.yuku.com/forum...-Technologies/

  9. #8
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,179
    Thanks
    47
    Thanked 983 Times in 913 Posts
    This can happen if you create the file in Windows Explorer, then edit it. Last time this happened to me it took me ages to spot the non-printing first character.

    cheers, Paul

Posting Permissions

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