Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Batch Programming Help

Posted on 2009-05-14
3
Medium Priority
?
207 Views
Last Modified: 2012-05-07
Hello Experts,
I need a little assistance with this batch file I am writing.  I need to copy some files into local users profiles.  Some of them have different versions of software loaded on there PC.   The batch file I created adds directories to the local PC.  I only want to copy the files not add to the directory.  Can someone assist on what I am doing wrong?

I was hoping to have one batch file for all users so they do not need to know what version they are running.

Thanks in advance for any help you can provide.
Bob

@ECHO off
CLS
ECHO Shape File update in Progress.
ECHO.
xcopy "Y:\AutoDesk\SETTINGS\SH650.*" "%userprofile%\Application Data\Autodesk\DWG TrueView 2010\R7\enu\Support" /D/Y/I
xcopy "Y:\AutoDesk\SETTINGS\SH650.*" "%userprofile%\Application Data\Autodesk\DWG TrueView 2009\R6\enu\Support" /D/Y/I
ECHO.
ECHO Backup of Shape File's is Complete.
Pause

Open in new window

0
Comment
Question by:RobertStamm
  • 2
3 Comments
 
LVL 38

Accepted Solution

by:
Shift-3 earned 1000 total points
ID: 24387160
You can use the IF command to determine whether to copy the files.


@ECHO off
CLS
ECHO Shape File update in Progress.
ECHO.
if exist "%appdata%\Autodesk\DWG TrueView 2010\R7\enu\Support" (
 xcopy "Y:\AutoDesk\SETTINGS\SH650.*" "%appdata%\Autodesk\DWG TrueView 2010\R7\enu\Support\" /D /C /H /R /Y
)
 
if exist "%appdata%\Autodesk\DWG TrueView 2009\R6\enu\Support" (
 xcopy "Y:\AutoDesk\SETTINGS\SH650.*" "%appdata%\Autodesk\DWG TrueView 2009\R6\enu\Support\" /D /C /H /R /Y
)
ECHO.
ECHO Backup of Shape Files is Complete.
Pause

Open in new window

0
 

Author Comment

by:RobertStamm
ID: 24387218
Great.  I am obviously a rookie at this.

Thanks for your help.
Bob
0
 

Author Closing Comment

by:RobertStamm
ID: 31581561
Thanks again.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

886 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