Created
July 20, 2010 14:21
-
-
Save justincampbell/483017 to your computer and use it in GitHub Desktop.
Threaded batch script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
set strVariable=[%1] | |
if %strVariable% NEQ [] goto :Thread | |
set intTotal=0 | |
echo Start %date% %time% | |
for /F %%a in ('net view ^| find /i "\\"') do call :Parse %%a | |
echo Stop %date% %time% | |
echo Total %intTotal% | |
goto :eof | |
:Parse | |
set strHost=%1 | |
set strHost=%strHost:\=% | |
start threaded.bat %strHost% | |
set /a intTotal=%intTotal%+1 | |
exit /b | |
:Thread | |
ping %1 -n 1 >nul | |
if %errorlevel% NEQ 0 exit | |
::Do some stuff to this host | |
::Save the data somehow if needed | |
::Could use sqlcmd, or flat files, or possibly save to system variables | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Would be a good way to do a threaded XCOPY .... sorta like RichCopy.exe .