You are here:

C#/Backup .BAT File

Advertisement


Question
I am running win7 and I wanted to make a .BAT File that when I click on it it will run a Backup.

I want to Backup a Folder called Notes on my Desktop on my C: Drive to my E: Drive.

So I did this code in notepad and saved it as .bat and yes I changed file format to ALL in the dropdown list.

xcopy c:\Users\Robert\Notes
e:\Roberts Backup
/e/v/c/y/f

<c:\Users\Robert\Desktop\Backuplog.txt

And this last line of code sould output a text Log file to my Desktop. But when I click this file it looks like it is trying to open I can see an outline of a big window and then it goes away.

And it never Runs or Backsup the Folder.

I just would like to know how to do this code thanks.

Answer
hi,

couple of questions.

1.  Do you want to execute backup from the code? or you want to your application to create .BAT file?

2. DO you want to run this as a EXE or BAT?  if you want to do develop in c# you can execute this as EXE NOT as BAT.

Please let me know so that I can point to right direction.

CHeers

-Srini

C#

All Answers


Answers by Expert:


Ask Experts

Volunteer


Srini Nagarajan

Expertise

can answer any kind of questions in ASP.NET, C#, VB.NET, ASP, SharePoint 2007, Coldfusion, Powerbuilder 7.00 / 8.00, JAVA servlets, MS SQL 2000 / MSSQL7, Sybase

Experience

Contact me if you need any custom development on ASP.NET, ASP, Coldfusion, Powerbuilder

©2016 About.com. All rights reserved.