troubleshooting Question

Change Batch script to Vbs or run more faster.

Avatar of bsharath
bsharathFlag for India asked on
Scripting LanguagesWindows BatchVB Script
16 Comments1 Solution475 ViewsLast Modified:
Hi,

Change Batch script to Vbs or run more faster.
Any way the same script can be changed to run any faster or to convert to Vbs.
Vbs or the same script can it run multiple machines at the same time. Like take first 5 machine names and run at the same time.

REgards
Sharath
:: BATCH SCRIPT START 
@ECHO OFF
SETLOCAL EnableDelayedExpansion
SET NetShare=\\ophos\ps
SET InputFile=Machines.txt
IF NOT EXIST "%NetShare%" ECHO Network share not found. &GOTO :EndScript
IF NOT EXIST "%InputFile%" ECHO "%InputFile%" file does not exist. &GOTO :EndScript
FOR %%R IN ("%InputFile%") DO IF %%~zR EQU 0 ECHO "%InputFile%" file is empty. &GOTO :EndScript
FOR /F %%c IN ('TYPE "%InputFile%"') DO (
        ECHO Processing: %%c
        IF EXIST "!NetShare!\%%c.txt" DEL /F /Q "!NetShare!\%%c.txt"
        FOR /F "delims=: tokens=1" %%d IN ('WMIC /NODE:"%%c" LOGICALDISK WHERE "DriveType=3" GET Name ^|FIND ":"') DO (
                DIR \\%%c\%%d$\*.mp3 /S /B 2>NUL >>"!NetShare!\%%c.txt"
                DIR \\%%c\%%d$\*.avi /S /B 2>NUL >>"!NetShare!\%%c.txt"
                DIR \\%%c\%%d$\*.mpg /S /B 2>NUL >>"!NetShare!\%%c.txt")
        )
 
:EndScript
ENDLOCAL
EXIT /B 0
:: BATCH SCRIPT END
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 16 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 16 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros