mkdir with user imput

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

vannyx

Thread Starter
Joined
Dec 24, 2005
Messages
3
OK this is for a class im taking and after spending 3 days trying to do it myself with notes and searching the web im lost.

here is what i need to do
17. Create a new subdirectory using as its name a replaceable parameter so the user can enter any name desired at the prompt when executing this batch file.

18. Move the file My_Interests_YYY.doc to the new directory (use a replaceable parameter when referring to the new directory)

19. Copy everything in the Plays_YYY subdirectory to the new directory with 1 command.

20. Change to a new subdirectory

Here is what i tried. I tried using the set command set directory =
but then i asked myself the question directory = what, i left it blank because when i put sort it gave an error.

then i had sort
then sort > directory
but that threw an error.

because directory isnt an internal command

some how i got it working still dont understand how or why it even worked but it did.

so now i got my user input string into the variable but here is where i have to kick myself because i just dont get it. i cant pass the info to mkdir or pipe it to mkdir.

Im pulling my hair out and this is due christmas day , can anyone help me please.
 

awalker0878 🎂

It's my birthday!
Removed by request
Joined
Dec 16, 2005
Messages
407
mkdir %1
move My_Interests_YYY.doc %1
xcopy /e Plays_YYY\*.* %1
cd %1
 

awalker0878 🎂

It's my birthday!
Removed by request
Joined
Dec 16, 2005
Messages
407
Logic
<comand file> <parameter1> <parameter2> etc
<comand file> = %0
<parameter1> = %1
<parameter2> = %2
 

vannyx

Thread Starter
Joined
Dec 24, 2005
Messages
3
thanks i understand now. but here is the problem i am are having

@ECHO OFF
ECHO.
ECHO This is a batch file
rem set directory =
echo Please enter a name
sort
mkdir %1



ECHO %1
PAUSE
CLS



here is the output

C:\testing>test

This is a batch file
Please enter a name
c:\testing\oknow
^Z
c:\testing\oknow
The syntax of the command is incorrect.
ECHO is off.
Press any key to continue . . .

what am i doing wrong.

Thank you so much you have no idea how much help you have been.
 

awalker0878 🎂

It's my birthday!
Removed by request
Joined
Dec 16, 2005
Messages
407
enter the dirname as parameter after the program
oknow dirname
 

vannyx

Thread Starter
Joined
Dec 24, 2005
Messages
3
rem Create a remark with your full name, MS205, and section but it
rem should NOT display
echo on
echo YYY and This is my MS205 project
pause
mkdir a:\Plays_yyy
pause
mkdir a:\Sports_yyy
pause
move a:\Comedy_yyy.doc a:\Play_yyy
pause
move a:\Tragedy_yyy.doc a:\Play_yyy
pause
move a:\Football_yyy.doc a:\Sports_yyy
pause
move a:\Baseball_yyy.doc a:\Sports_yyy
pause
copy a:\Play_yyy\Comedy_yyy.doc a:
pause
Print a:\Play_yyy\comedy_yyy.doc
pause
dir /o /d > a:\structure.txt
pause
tree /a
pause
cd a:\Sports_yyy
pause
copy a:\Sports_yyy\Baseball_yyy.doc a:
pause
fc a:\Sports_yyy\Baseball_yyy.doc a:\Baseball_yyy.doc
pause
cd a:\
pause
echo off
sort
mkdir %1
move My_Interests_YYY.doc %1
xcopy /e Plays_YYY\*.* %1
cd %1
dir /w
rmdir /s %1
echo
sort
edit %1
exit

here is the final product. everything works fine up to the mkdir.

Im confused.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top