Solved

make search and edit batch script faster...

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

734 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