Solved

make search and edit batch script faster...

Posted on 2012-03-13
1
298 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
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
Utilizing an array to gracefully append to a list of EmailAddresses
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now