Solved

make search and edit batch script faster...

Posted on 2012-03-13
1
303 Views
Last Modified: 2012-08-14
The below script works fine.  Just a little slow.  It is because it is searching so many drives.   but is there a way to make the script 'faster"? Even a second or two would be nice

One thing I should mention is, the "bquest" folder would be located somewhere in the folder %programfiles%.  maybe we can edit this to go directly to that directory first...

@echo off
(for %%i in (C D E F G) do (dir %%i:\*bquest /s /b /ad))>dir_search.txt
for /f "tokens=* delims=" %%x in (dir_search.txt) do (
    if not exist "%%x\keycode" (  
    copy /v /y etkey "%%x\keycode" >NUL 2>&1
    attrib +r "%%x\keycode" >NUL 2>&1
  )
)
0
Comment
Question by:icecom4
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 37722675
Hi, one way to make it faster would be to change
(dir %%i:\*bquest /s /b /ad)
to
(dir %%i:\program files\*bquest /s /b /ad)

Note: You need to hardcode Program Files instead of %programfiles% because the %programfiles% variable contains a drive letter.

Another way to make it faster would be to create a separate batch file for each drive, as in

(dir "C:\Program Files\*bquest" /s /b /ad))>dir_search.txt
for /f "tokens=* delims=" %%x in (dir_search.txt) do (
    if not exist "%%x\keycode" (  
    copy /v /y etkey "%%x\keycode" >NUL 2>&1
    attrib +r "%%x\keycode" >NUL 2>&1
  )
)

Open in new window


and
(dir "D:\Program Files\*bquest" /s /b /ad))>dir_search.txt
for /f "tokens=* delims=" %%x in (dir_search.txt) do (
    if not exist "%%x\keycode" (  
    copy /v /y etkey "%%x\keycode" >NUL 2>&1
    attrib +r "%%x\keycode" >NUL 2>&1
  )
)

Open in new window


etc, and then kick them all off at the same time.  This way you search each drive concurrently, instead of sequentially.

Regards,

Rob.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question