0
업데이트 된 라이센스가 'style.mfx'파일에 저장되어 있습니다. 우리는 사용자에게 보내서 이전 파일을 그 이름으로 자동 교체하려고합니다. 파일은 항상 c :가됩니다. 나는이 데모를 행운으로 시험해 보았습니다. 배치 파일에서 targetName 및 replacementFile을 하드 코딩하고 싶습니다.우리는 라이센스를 업그레이드하기 위해 bat 파일을 실행하기 만하면됩니다.
@echo off
set targetName=%~NX1
set replacementFile=%~F2
call :processFolder
goto :EOF
:processFolder
rem For each folder in this level
for /D %%a in (*) do (
rem Enter into it, process it and go back to original
cd %%a
if exist "%targetName%" (
copy "%replacementFile%" "%targetName%" /Y
)
call :processFolder
cd ..
)
exit /B
cmd line이 작동하지 않습니다! 하지만 배치 파일에 인수가 필요합니다 ...
app teststyle.mfx c:\teststyle.mfx
c:\Users\Joseph\Desktop>replace.bat teststyle.mfx c:\teststyle.mfx
c:\Users\Joseph\Desktop>
어떤 도움을 주시면 감사하겠습니다.
정말로 사용자의 컴퓨터에서 라이센스 파일을 자동으로 변경 하시겠습니까? – Silverclaw
예. '' '' '' ''. –
배치 파일을 개발할 때 특히 까다로운 버그가있는 경우'@echo off '를 제거하면 코드 줄마다 실행되는 것을 볼 수 있으며 버퍼를 뒤져서 무엇이 잘못되었는지에 대한 단서를 찾을 수 있습니다. – abelenky