Batch file and undersores RRS feed

  • Question

  • I wrote a simple batch file to sort a delimited file, output it to another file, delete the original, and then rename the output. Problem is, it won't work with filenames containing underscores:

    Doesn't work: 

    SORT Solicitation_4_OutputFile.txt 1> output.txt
    TIMEOUT /t 1 /nobreak
    del Solicitation_4_OutputFile.txt
    TIMEOUT /t 1 /nobreak
    ren output.txt Solicitation_4_OutputFile.txt

    Does work:

    SORT Solicitation4Output.txt 1> output.txt
    TIMEOUT /t 1 /nobreak
    del Solicitation4Output.txt
    TIMEOUT /t /nobreak
    ren output.txt Solicitation4Output.txt

    Any way to make it work with filenames containing underscores? 

    Friday, October 30, 2015 2:19 PM


  • Doesn't work:

    I wince when I see reports such as "Does not work". You seem to assume that we can see your screen. Please report in detail what happens and what you see on the screen!

    Note also that underscores have no special meaning in batch files. Your problem lies elsewhere.

    Friday, October 30, 2015 2:59 PM