Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 684
  • Last Modified:

Batch file that asks question and uses answer

I'm trying to create a batch file for copying Floppy disks to a loocation on C

I want to ask for a title of the disk and then use that title as the folder name you can see what i mean and how far I have got at the moment in the code
:copy
Echo Floppy Disk Title?
 == 1%
XCOPY a:\*.* c:\FLOPPIES\%1\ /s 
ECHO Enter next Disk
PAUSE
goto copy

Open in new window

0
alex4544
Asked:
alex4544
  • 5
  • 3
1 Solution
 
Jammer59Commented:
How about
:copy
Echo Floppy Disk Title
set /p DiskTitle=
XCOPY a:\*.* c:\FLOPPIES\%DiskTitle\  /s
ECHO Enter next Disk PAUSE goto copy  
Reference:
0
 
Jammer59Commented:
0
 
AmazingTechCommented:
Don't use copy as a label since it's an internal command.
:copylabel
Set /p Folder=Floppy Disk Title? 
XCOPY a:\*.* "c:\FLOPPIES\%Folder%\" /s 
ECHO Enter next Disk
PAUSE
goto copylabel

Open in new window

0
New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

 
alex4544Author Commented:
Thanks guys - I figured this out just after i posted it with the following - basically the same as what you have given.

Is there a way to auto incrememnt the number? so I can just put disk in - press enter and let it go?
:copydisk
Set /P Name=Enter Disk Name^>
XCOPY a:\*.* c:\FLOPPIES\"%Name%"\ /s 
ECHO Enter next Disk
PAUSE
goto copydisk

Open in new window

0
 
Jammer59Commented:
What number do you want to increment?
 
0
 
alex4544Author Commented:
Just to automaticLly create a folder named 1 and then next disk named 2 repeating
0
 
Jammer59Commented:
So, If you enter "Data" as the disk name, would you want the directory structure to be:
c:\FLOPPIES\Data\1\
c:\FLOPPIES\Data\2\
c:\FLOPPIES\DATA\3\
OR
c:\FLOPPIES\Data1\
c:\FLOPPIES\Data2\
c:\FLOPPIES\Data3\
 
0
 
Jammer59Commented:
For the First Example above use:

set Count=0
Set /P Name=Enter Disk Name^>
:copydisk
ECHO a:\*.* c:\FLOPPIES\%Name%\%Count% /s
SET /A Count = Count + 1
ECHO Enter next Disk
PAUSE
goto copydisk
For the Second Example above use

set Count=0
Set /P Name=Enter Disk Name^>
:copydisk
ECHO a:\*.* c:\FLOPPIES\%Name%%Count% /s
SET /A Count = Count + 1
ECHO Enter next Disk
PAUSE
goto copydisk
 
0
 
alex4544Author Commented:
Excellent thank you
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now