-1

How my bath file can process space in path example:

C:\Documents and Settings\K\Desktop\New Folder

@echo off
pushd "%~dp0"
IF EXIST "%1" GOTO DECODE_INDIVIDUAL

:DECODE_MULTIPLE
xcopy /s /c /d /e /h /i /r /y "%cd%\encoded" "%cd%\decoded\"
dir %cd%\decoded\*.php  /A:-D /B /O:N /S >> %cd%\filelist.txt

@echo on
for /F %%e in (%cd%\filelist.txt) do ( copy "%%e" "bin\file.php" && "php.exe" "bin\decoder.php" "bin\file.php" && move "bin\file.php" "%%e" && del "bin\file.php")
del /Q "%cd%\filelist.txt"
GOTO DECODE_END

:DECODE_INDIVIDUAL
@echo on
"php.exe" "%cd%\bin\decoder.php" "%1"

:DECODE_END
ceejayoz
  • 32,910
  • 7
  • 82
  • 106
  • Your question is off topic for Serverfault because it doesn't appear to relate to servers/networking or desktop infrastructure in a professional environment. It may be on topic for [Superuser](http://superuser.com) but please [search](http://superuser.com/search) their site for similar questions that may already have the answer you're looking for. – Dennis Kaarsemaker Mar 28 '13 at 00:31

2 Answers2

1

CMD doesn’t like spaces in directories so use quote your path as below:

“C:\Documents and Settings\K\Desktop\New Folder”

Ben Lavender
  • 284
  • 1
  • 5
  • C:\Documents and Settings\K\Desktop\DECODER>for /F %e in ("C:\Documents and Sett ings\K\Desktop\DECODER\filelist.txt") do (copy "%e" "bin\file.php" && "php.exe " "bin\phplockit_decoder.php" "bin\file.php" && move "bin\file.php" "%e" && del "bin\file.php" ) C:\Documents and Settings\K\Desktop\DECODER>(copy "C:\Documents" "bin\file.php" && "php.exe" "bin\phplockit_decoder.php" "bin\file.php" && move "bin\file.ph p" "C:\Documents" && del "bin\file.php" ) 1 file(s) copied. – user699998 Mar 19 '13 at 19:50
1

I added quotes around a few file path locations... this should work:

@echo off
pushd "%~dp0"
IF EXIST "%1" GOTO DECODE_INDIVIDUAL

:DECODE_MULTIPLE
xcopy /s /c /d /e /h /i /r /y "%cd%\encoded" "%cd%\decoded\"
dir "%cd%\decoded\*.php"  /A:-D /B /O:N /S >> "%cd%\filelist.txt"

@echo on
for /F "tokens=*" %%e in ("%cd%\filelist.txt") do ( copy "%%e" ".\bin\file.php" && "php.exe" ".\bin\decoder.php" ".\bin\file.php" && move ".\bin\file.php" "%%e" && del ".\bin\file.php")
del /Q "%cd%\filelist.txt"
GOTO DECODE_END

:DECODE_INDIVIDUAL
@echo on
"php.exe" "%cd%\bin\decoder.php" "%1"

:DECODE_END
Glenn Sullivan
  • 1,368
  • 9
  • 17