Solved

Batch Programming Help

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This video discusses moving either the default database or any database to a new volume.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now