dos scripts


dos scripts hugo

1. dos copy batch script

for /f "delims=" %%I in (4.txt) do echo D| xcopy "D:\Apache Software Foundation\Tomcat 7.0\webapps\DigiUpload\segments\%%I" "D:\Pramod_temp\[[batch]] copy files\MissingSegments\Grade5\%%I" /s /i

2. dos copy batch script - 2

@echo off
setlocal

set CtxProfilePath=D:\CtxProfile
set CtxProfileDownloadPath=Win10RS2v6\UPM_Profile\downloads
::note: CtxProfileDownloadPath is a path relative to CtxProfilePath
::i.e.: %CtxProfilePath%\{user}\%CtxProfileDownloadPath%

set RemoteShare=\\ServerName\ShareName
set RemoteUserHomePath=file\home
set RemoteUserDownloadPath=Downloads
::note: RemoteUserHomePath and RemoteUserDownloadPath are paths relative to RemoteShare
::i.e.: %RemoteShare%\%RemoteUserHomePath%\{user}\%RemoteUserDownloadPath%

for /d %%U in ("%CtxProfilePath%\*") do (
  if "%~1" == "/copy" (
    xcopy /i /s /y "%%U\%CtxProfileDownloadPath%" "\\%RemoteShare%\%RemoteUserHomePath%\%%~nxU\%RemoteUserDownloadPath%"
  ) else (
    echo xcopy /i /s /y "%%U\%CtxProfileDownloadPath%" "\\%RemoteShare%\%RemoteUserHomePath%\%%~nxU\%RemoteUserDownloadPath%"
  )
)

3. dos while read

@echo off
for /f "tokens=*" %%a in (input.txt) do call :processline %%a

pause
goto :eof

:processline
echo line=%*
mkdir %*

goto :eof

:eof