Solved

Batch Programming Help

Posted on 2009-05-14
3
202 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 250 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

How our DevOps Team Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

825 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