I need to copy files using Windows command-line (available on XP Pro or later by default) and show progress during the process.
The progress indicator could be in a terminal or a GUI window. It is intended to be used during batch file scripting.
I need to copy files using Windows command-line (available on XP Pro or later by default) and show progress during the process.
The progress indicator could be in a terminal or a GUI window. It is intended to be used during batch file scripting.
I used the copy command with the /z switch for copying over network drives. Also works for copying between local drives. Tested on XP Home edition.
Robocopy, or "Robust File Copy", is a command-line directory and/or file replication command. Robocopy functionally replaces Xcopy, with more options. It has been available as part of the Windows Resource Kit starting with Windows NT 4.0, and was first introduced as a standard feature in Windows Vista and Windows Server 2008. The command is
robocopy...
This technet link has some good info for copying large files. I used an exchange server utility mentioned in the article which shows progress and uses non buffered copy functions internally for faster transfer.
In another scenario, I used robocopy. Robocopy GUI makes it easier to get your command line options right.
If you want to copy files and see a "progress" I suggest the script below in Batch that I used from another script as a base
I used a progress bar and a percentage while the script copies the game files Nuclear throne:
@echo off
title NTU Installer
setlocal EnableDelayedExpansion
@echo Iniciando instalacao...
if not exist "C:\NTU" (
md "C:\NTU
)
if not exist "C:\NTU\Profile" (
md "C:\NTU\Profile"
)
ping -n 5 localhost >nul
for %%f in (*.*) do set/a vb+=1
set "barra="
::loop da barra
for /l %%i in (1,1,70) do set "barra=!barra!Û"
rem barra vaiza para ser preenchida
set "resto="
rem loop da barra vazia
for /l %%i in (1,1,110) do set "resto=!resto!"
set i=0
rem carregameno de arquivos
for %%f in (*.*) do (
>>"log_ntu.css" (
copy "%%f" "C:\NTU">nul
echo Copiado:%%f
)
cls
set /a i+=1,percent=i*100/vb,barlen=70*percent/100
for %%a in (!barlen!) do echo !percent!%% /
[!barra:~0,%%a!%resto%]
echo Instalado:[%%f] / Complete:[!percent!%%/100%]
ping localhost -n 1.9 >nul
)
xcopy /e "Profile" "C:\NTU\Profile">"log_profile.css"
@echo Criando atalho na area de trabalho...
copy "NTU.lnk" "C:\Users\%username%\Desktop">nul
ping localhost -n 4 >nul
@echo Arquivos instalados!
pause