PC Review


Reply
Thread Tools Rate Thread

Creating batch file for backup

 
 
=?Utf-8?B?QW50aG9ueQ==?=
Guest
Posts: n/a
 
      24th Oct 2006
Hi all, I am trying to write a batch file to copy a folder to an external
hard drive. I have got the batch file working correctly, but when I plug in
the ext drive it is grabbing drive letter "g" all the time. I have set it
grab drive "z" but does not always do this. I would like to have the batch
file stop and ask what the drive letter is and then proceed using that drive
letter...is this at all possible? I have found the choice command but I don't
think that is available in WinXP...any help greatly appreciated. Cheers
 
Reply With Quote
 
 
 
 
Ayush
Guest
Posts: n/a
 
      25th Oct 2006
Use set command with p parameter. It will look like this :
set /p Variablename=
It will stop , you can enter the drive letter then press enter. Now the value of
Variablename will be what you typed.
You can type anything after the "=" sign, it will echo that, it will not affect the
variable. Like:
set /p Variablename=Type the drive letter:
--
> Ayush [ Be ''?'' Happy ]


For any query, search > www.Google.com
Want to know about a term > http://en.wikipedia.org

Replied To :
-------------------------------------------------------------

"Anthony" <(E-Mail Removed)> wrote in message
news:9E4D6542-E75A-4293-91BC-(E-Mail Removed)...
: Hi all, I am trying to write a batch file to copy a folder to an external
: hard drive. I have got the batch file working correctly, but when I plug in
: the ext drive it is grabbing drive letter "g" all the time. I have set it
: grab drive "z" but does not always do this. I would like to have the batch
: file stop and ask what the drive letter is and then proceed using that drive
: letter...is this at all possible? I have found the choice command but I don't
: think that is available in WinXP...any help greatly appreciated. Cheers


 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      25th Oct 2006

"Anthony" <(E-Mail Removed)> wrote in message
news:9E4D6542-E75A-4293-91BC-(E-Mail Removed)...
> Hi all, I am trying to write a batch file to copy a folder to an external
> hard drive. I have got the batch file working correctly, but when I plug

in
> the ext drive it is grabbing drive letter "g" all the time. I have set it
> grab drive "z" but does not always do this. I would like to have the batch
> file stop and ask what the drive letter is and then proceed using that

drive
> letter...is this at all possible? I have found the choice command but I

don't
> think that is available in WinXP...any help greatly appreciated. Cheers


Try this:

@echo off
set /p Drive=Please enter the drive letter (e.g. Q
if "%Drive%"=="" goto :eof
xcopy %Drive%\*.* d:\


 
Reply With Quote
 
=?Utf-8?B?QW50aG9ueQ==?=
Guest
Posts: n/a
 
      25th Oct 2006
Thank you so much...works an absolute treat. Have a fabulous day

Cheers :-)

"Pegasus (MVP)" wrote:

>
> "Anthony" <(E-Mail Removed)> wrote in message
> news:9E4D6542-E75A-4293-91BC-(E-Mail Removed)...
> > Hi all, I am trying to write a batch file to copy a folder to an external
> > hard drive. I have got the batch file working correctly, but when I plug

> in
> > the ext drive it is grabbing drive letter "g" all the time. I have set it
> > grab drive "z" but does not always do this. I would like to have the batch
> > file stop and ask what the drive letter is and then proceed using that

> drive
> > letter...is this at all possible? I have found the choice command but I

> don't
> > think that is available in WinXP...any help greatly appreciated. Cheers

>
> Try this:
>
> @echo off
> set /p Drive=Please enter the drive letter (e.g. Q
> if "%Drive%"=="" goto :eof
> xcopy %Drive%\*.* d:\
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a batch file for backup? Eric Windows XP General 2 10th Jan 2010 10:43 AM
Backup batch file needed Hans Näslund Microsoft Windows 2000 8 18th Aug 2006 03:23 PM
Batch file to backup to CD-RW Saycoda Windows XP General 1 16th Jul 2006 01:51 PM
Backup Batch File Ron Boetger Windows XP General 7 7th Jun 2004 02:30 PM
Batch File to backup? HeatherM Microsoft Access 2 8th Jan 2004 05:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:53 AM.