Computing.Net > Forums > Programming > Batch File to find directory and co

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch File to find directory and co

Reply to Message Icon

Name: Inferi0r
Date: August 18, 2007 at 15:15:35 Pacific
OS: Windows XP Pro
CPU/Ram: 1,8Ghz - 512MB
Product: HP
Comment:

Hello,

I'm making a batch that can automatically update my WindowsDefender executable.

The following must happened:
Copy all files from the directory "%AllUsersProfile%\Application Data\Microsoft\Windows Defender\Definition Updates\{*}"
To the subdirectory "Updates" of the place where the bat file is running. (that place is always changing, also changing drives)

Note: there are a few directories in the "%AllUsersProfile%\Application Data\Microsoft\Windows Defender\Definition Updates\" folder, but not with names which starts and end with '{' and '}'/

Thanks in advance



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: August 18, 2007 at 15:58:45 Pacific
Reply:

XCOPY /E /V /C /I /F /G /H /R /Y /Z "%AllUsersProfile%\Application Data\Microsoft\Windows Defender\Definition Updates\*.*" Updates

That's all one line, BTW.


0

Response Number 2
Name: Inferi0r
Date: August 18, 2007 at 17:27:16 Pacific
Reply:

I was looking for a FOR command because there is a wildcard in the foldername not in the filename. This would be the good command: "%AllUsersProfile%\Application Data\Microsoft\Windows Defender\Definition Updates\{BDE4294C-01A6-464C-A790-D4EE5B6F7AEA}\*.*"

But {BDE4294C-01A6-464C-A790-D4EE5B6F7AEA} is always changing. And 'FOR /F %%i IN ('DIR /B /A-D "%AllUsersProfile%\Application Data\Microsoft\Windows Defender\Definition Updates\*"') COPY "%AllUsersProfile%\Application Data\Microsoft\Windows Defender\Definition Updates\%%i\*" "Updates"' isn't working because there are more folders in the 'Definition Updates' directory.

Thanks


0

Response Number 3
Name: Razor2.3
Date: August 20, 2007 at 17:50:51 Pacific
Reply:

No, it's not working because DIR /A-D gives you everything that's NOT a directory.

DIR /AD would give you everything that IS a directory.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch File to find directory and co

Batch file to find ip and host name, and save www.computing.net/answers/programming/batch-file-to-find-ip-and-host-name-and-save/19455.html

Batch File to find files www.computing.net/answers/programming/batch-file-to-find-files/17076.html

batch file to find and copy www.computing.net/answers/programming/batch-file-to-find-and-copy/9236.html