Solved

make search and edit batch script faster...

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
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 …
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 a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

749 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