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,889
    Thanks
    111
    Thanked 143 Times in 140 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,889
    Thanks
    111
    Thanked 143 Times in 140 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,364
    Thanks
    35
    Thanked 349 Times in 304 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
    Confuscius said: "no use running harder if you're on the wrong road" and "any problem once correctly understood is already half-solved".

  7. #6
    WS Lounge VIP mrjimphelps's Avatar
    Join Date
    Dec 2009
    Location
    USA
    Posts
    3,728
    Thanks
    485
    Thanked 436 Times in 407 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,889
    Thanks
    111
    Thanked 143 Times in 140 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,689
    Thanks
    59
    Thanked 1,065 Times in 990 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
  •