Installer: Fallback to `copy" when "robocopy" fails, Part 2

This commit is contained in:
Nodir Temirkhodjaev 2024-05-28 20:40:37 +03:00
parent a6ba0779dd
commit afa91d7fcc

View File

@ -10,13 +10,29 @@
@goto EXIT
)
robocopy "%SRCDIR%" "%DSTDIR%" "%FILENAME%" /R:0 >NUL || copy "%SRCPATH%" "%DSTPATH%"
@if not exist "%SystemRoot%\System32\robocopy.exe" @goto USE_COPY
robocopy "%SRCDIR%" "%DSTDIR%" "%FILENAME%" /R:0 >NUL
@if ERRORLEVEL 2 (
@echo Error: Cannot copy driver to system
@set RCODE=%ERRORLEVEL%
@goto EXIT
)
@goto END_USE_COPY
:USE_COPY
copy "%SRCPATH%" "%DSTPATH%"
@if ERRORLEVEL 1 (
@echo Error: Cannot copy driver to system
@set RCODE=%ERRORLEVEL%
@goto EXIT
)
:END_USE_COPY
@rem Create the driver service
sc create %DRIVERSVC% binPath= "%DSTPATH%" type= kernel start= auto ^