@echo off setlocal enableextensions pushd "%SystemDrive%\" set "LOCAL_ROOT=C:\PYTHON_LOCAL\MyICR_Suite" set "SERVER_DIR=%~dp0" set "SERVER_DIR=%SERVER_DIR:~0,-1%" set "PYTHON_EXE=%LOCAL_ROOT%\python\pythonw.exe" echo. echo ============================================ echo MyICR Suite echo ============================================ echo. REM Prima installazione: copia python\ con PowerShell Write-Progress if exist "%PYTHON_EXE%" goto start_bootstrap echo [1/2] Prima installazione: copia Python dal server... echo Attendere - operazione di alcuni minuti. echo. del "%TEMP%\mycir_install.ps1" 2>nul del "%TEMP%\mycir_rob.log" 2>nul echo $src = '%SERVER_DIR%\python' >> "%TEMP%\mycir_install.ps1" echo $dst = '%LOCAL_ROOT%\python' >> "%TEMP%\mycir_install.ps1" echo $log = "$env:TEMP\mycir_rob.log" >> "%TEMP%\mycir_install.ps1" echo $total = (Get-ChildItem $src -Recurse -File).Count >> "%TEMP%\mycir_install.ps1" echo Write-Progress -Activity 'Installazione Python' -Status "Conteggio file in corso..." -PercentComplete 0 >> "%TEMP%\mycir_install.ps1" echo $proc = Start-Process robocopy -ArgumentList "`"$src`" `"$dst`" /E /NDL /NJH /NJS /NP" -RedirectStandardOutput $log -NoNewWindow -PassThru >> "%TEMP%\mycir_install.ps1" echo while (-not $proc.HasExited) { >> "%TEMP%\mycir_install.ps1" echo $n = (Get-Content $log -EA SilentlyContinue ^| Measure-Object -Line).Lines >> "%TEMP%\mycir_install.ps1" echo if ($n -and $total) { >> "%TEMP%\mycir_install.ps1" echo $pct = [Math]::Min([int]($n*100/$total),99) >> "%TEMP%\mycir_install.ps1" echo Write-Progress -Activity 'Installazione Python' -Status "File: $n / $total" -PercentComplete $pct >> "%TEMP%\mycir_install.ps1" echo } >> "%TEMP%\mycir_install.ps1" echo Start-Sleep -Milliseconds 300 >> "%TEMP%\mycir_install.ps1" echo } >> "%TEMP%\mycir_install.ps1" echo Write-Progress -Completed -Activity 'Installazione Python' >> "%TEMP%\mycir_install.ps1" echo Remove-Item $log -EA SilentlyContinue >> "%TEMP%\mycir_install.ps1" powershell -NoProfile -ExecutionPolicy Bypass -File "%TEMP%\mycir_install.ps1" del "%TEMP%\mycir_install.ps1" 2>nul if not exist "%PYTHON_EXE%" ( echo [ERRORE] Installazione Python fallita. Contattare il supporto. pause & exit /b 1 ) echo [1/2] Python installato. echo. :start_bootstrap echo [2/2] Avvio sincronizzazione... start "" "%PYTHON_EXE%" "%SERVER_DIR%\bootstrap.py" endlocal & exit /b 0