Home > other >  Cannot parse file names with ! in them but double quoted?
Cannot parse file names with ! in them but double quoted?

Time:03-16

I've probably pushed myself into a corner here but for some reason this batch will handle pretty much any name except one with a ! in it. I cannot figure out why for the life of me what I've done wrong. If the file has a ! in the name it ignores it and creates a new one with no ! which gets moved into the batch directory. Actually every instance of that file name ends up missing the ! even the quote in the output MGL:

setlocal enabledelayedexpansion
            set choice=
        set /p choice= Type selection and press enter: 
            if '%choice%'=='1' set console=SNES
            if '%choice%'=='1' set settings=delay="2" type="f" index="0"
            if '%choice%'=='2' set console=PSX
            if '%choice%'=='2' set settings=delay="1" type="s" index="0"
            if '%choice%'=='3' set console=gameboy
            if '%choice%'=='3' set settings=delay="1" type="f" index="1"
            if '%choice%'=='4' set console=C64
            if '%choice%'=='4' set settings=delay="1" type="f" index="1"
            
    mkdir MGL_!console! > nul 2>&1
    
    for /R %%a in (*.32x,*.a26,*.a78,*.abs,*.bin,*.bs,*.chd,*.cof,*.col,*.fds,*.gb,*.gbc,*.gba,*.gg,*.j64,*.jag,*.lnx,*.md,*.neo,*.nes,*.o,*.pce,*.rom,*.sc,*.sfc,*.sg,*.smc,*.smd,*.sms,"*.vec",*.wsc,*.ws) do (
    
        set "filepath=%%a"
        set "filepath=!filepath:           
  • Related