Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Subject: search all drives for 'instances of

Original Message
Name: tuk
Date: May 6, 2008 at 09:43:52 Pacific
Subject: search all drives for 'instances of
OS: VISTA
CPU/Ram: Opteron 2x2Ghz and 2.5Gb
Model/Manufacturer: custom
Comment:
Hi, great site! Iv been helped a lot by this forum over the last week while putting together a batch file..this is 1 of the best batch sites iv found..of which there are many...so thanks so far
-----------------------

I'v create a batch file to backup a 'user profile' folder that could exist in 4 different known locations on c:\(or it could be present in all 4 locations on c:\)

So far so good, The problem starts if the profile is located on an unknown drive or path:..im really struggling with this and indeed may be thinking the wrong way with needing 2 seperate batches


In thinking:
1)
Create a second batch file which searches all drives for instances of the 'user profile' folder, then assigns the path of each profile found to a variable
2)
2nd batch file would then edit the first batch, ie search and replace all known 'folder location data' with the new paths stored in the variables created

Constraints:
a)
Its possible the user could have saved the profile to non default location, so just changing driver letters may not be enough

so to verify a 'found user profile':

:bat2
Do all instances of file found (

If found(
"\Call of Duty 4 - Modern Warfare\players\profiles\active.txt"
)
then assign 'full path' to variable
)

any help would be appreciated


Report Offensive Message For Removal

Response Number 1
Name: tuk
Date: May 6, 2008 at 18:07:40 Pacific
Subject: search all drives for 'instances of
Reply: (edit)
ok after botching some codes from around this forum I can now search all drives for a folder

Im sure this code is processing more than it needs to, how can i tweak the inner for loop
to search all drives/files(instead of only its own folder) removing the need for the outer for loop

@echo off
setLocal EnableDelayedExpansion

for %%d in (C D) do (
for /f "tokens=* delims= " %%a in ('dir/s/b/a-s \"Call of Duty 4 -

Modern Warfare"') do (
set var=%%~DPa
echo the path to profile directory is !var!
)

)
@pause


Report Offensive Follow Up For Removal

Response Number 2
Name: klint
Date: May 7, 2008 at 07:21:31 Pacific
Subject: search all drives for 'instances of
Reply: (edit)
Remove the outer loop and replace the inner one with this:
for /f "tokens=* delims= " %%a in ('dir/s/b/a-s "C:\Call of Duty 4 - Modern Warfare" "D:\Call of Duty 4 - Modern Warfare"')

By the way, are you sure every PC has just a C: and a D: drive? What if it had an E: drive?


Report Offensive Follow Up For Removal

Response Number 3
Name: tuk
Date: May 9, 2008 at 11:07:37 Pacific
Subject: search all drives for 'instances of
Reply: (edit)
IGNORE

Report Offensive Follow Up For Removal

Response Number 4
Name: tuk
Date: May 9, 2008 at 13:34:18 Pacific
Subject: search all drives for 'instances of
Reply: (edit)
Going loopy with this, basically I need a batch file to:

1)Start searching C: for folder called "players"
2)
IF Found:
search the path of the folder(as a string) for string "VirtualStore" If True assign folder path to variable + "UAC ON"
ELSE
search the folder path location for a
file called iw3mp.exe IF TRUE assign
folder path to variable + "UAC OFF"
ELSE Continue Searching Tthe Rest Of
The Drive
3)Repeat Until All available HD's have been searched D E F etc, with Found/Verified 'players folder' locations set to variables

The code below is to check for the "VirtualStore" string in the pathname ..but it complains of wrong syntax in the FOR statment...also I would need to create variables on the fly because the number of profiles that it could be found is unknown

ECHO SEARCHING...


FOR /f "tokens=* delims= " %%a IN ('dir/s/b/a-s "\players"') DO (


echo %playersLoc% | find "VirtualStore"

if errorlevel 1 goto :not-found

:found
ECHO found
goto :end

:not-found
ECHO not found

:end


)


Report Offensive Follow Up For Removal

Response Number 5
Name: tuk
Date: May 10, 2008 at 13:33:14 Pacific
Subject: search all drives for 'instances of
Reply: (edit)
humpty bumpty


Report Offensive Follow Up For Removal

Response Number 6
Name: klint
Date: May 12, 2008 at 01:54:53 Pacific
Subject: search all drives for 'instances of
Reply: (edit)
The command processor doesn't like the closing bracket coming straight after a label. If you add a statement (such as type nul) between :end and ")" then it will work.

What you're doing may be easier with VBScript, but I'm not an expert in that; others on this forum are.


Report Offensive Follow Up For Removal



Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: search all drives for 'instances of

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software



Version Tracker Pro
Keep your software current and secure, effortlessly

Click Here for a Free Scan

Driver Agent
Automatically find the latest drivers for your computer.
Click Here for a Free Scan



The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC