FINDSTR无法打开带空格的路径

时间:2011-11-14 21:47:55

标签: path batch-file space findstr

拖放.bat,它接受文件,
把它放在2个列表中并同时处理这两个列表。

我通过路径:X:\folder\folder number\begin.txt进入%1
如果我有foldernumber

,它工作正常
PUSHD %~dp0
:loop
    IF ["%~f1"] EQU [""] goto :out

    echo %~f1>>list
    set /a count+=1
    SHIFT
goto :loop

POPD
:out

if %count% LEQ 1 (copy list list1 && goto :START)
set /a count2=%count%/2
more /e +%count2% list > list2

set count=0
setlocal enabledelayedexpansion
for /F "eol=; tokens=* delims=," %%i in (list) do (
    set /a count+=1
    if !count! leq !count2! echo %%i >>list1    
)
endlocal

:: Create the 2nd .bat for multiprocessing and start multiprocessing
more /e +88 mybat.bat > temp.bat
START "2nd Process mybat2" temp.bat

:start
    for /f "eol=; tokens=* delims==," %%i in (list1) do call :SEARCH %%i
    goto :END
:: 88th line here
    for /f "eol=; tokens=* delims==," %%k in (list2) do call :SEARCH %%k
    goto :END

:search
    setlocal enabledelayedexpansion
    for %%A in (jan feb mar apr mai etc...) DO (
        findstr /m "%%A" "%~f1" > NUL
        if !ERRORLEVEL! == 0 (
            call :theend %~1 %%A
            goto :EOF
        )
    )
    endlocal

我收到此错误消息“FINDSTR:无法打开X:\ folder \文件夹编号\ begin.txt”
有没有办法解决这个问题? 感谢

1 个答案:

答案 0 :(得分:2)

让我们看看您的文件是否正常:

是否可以使用这些内容创建批处理文件

echo %*
set /p dummy=press return

删除名称中带有空格的文件并发布结果?