Can someone help me with this?!
Moderator: DosItHelp
-
- Posts: 2
- Joined: 18 Sep 2011 10:24
Can someone help me with this?!
I'm totally confused!!
Create a batch file that meets the following criteria:
1) displays your first name
2) displays your last name on the next line
3) creates a directory called "hokus" in C:\
4) creates a directory called "pokus" in C:\hokus\
5) copies notepad.exe into C:\hokus\pokus\
(hint: you'll need to find where notepad.exe is first)
6) no commands should show when running the batch, only the results of those commands
7) show a directory listing of C:\hokus\pokus
display the word "done"
Create a batch file that meets the following criteria:
1) displays your first name
2) displays your last name on the next line
3) creates a directory called "hokus" in C:\
4) creates a directory called "pokus" in C:\hokus\
5) copies notepad.exe into C:\hokus\pokus\
(hint: you'll need to find where notepad.exe is first)
6) no commands should show when running the batch, only the results of those commands
7) show a directory listing of C:\hokus\pokus
display the word "done"
-
- Posts: 2
- Joined: 18 Sep 2011 10:24
Re: Can someone help me with this?!
How do I copy notepad.exe into the directory?? How do i find it??
-
- Posts: 104
- Joined: 28 Jul 2011 17:32
Re: Can someone help me with this?!
Code: Select all
@echo off
cd c:\
if exist "hokus" (goto check) else (goto start)
:check
cd .\hokus
if exist name (
goto check_2
) else (
goto start
)
:check_2
< name (
set /p line1=
set /p line2=
)
goto start_a
:start
echo What is your first name?
set /p FN=
cls
echo What is your second name?
set /p SN=
cd c:\
md hokus
cd .\hokus
echo %FN%>name
echo %SN%>>name
set line1=%FN%
set line2=%SN%
:start_a
cls
echo %line1%
echo %line2%
echo The "hokus" folder has been done in c:\
cd c:\hokus
md pokus
echo The "pokus" folder has been done in c:\hokus
copy C:\Windows\System32\notepad.exe c:\hokus\pokus
echo The notepad.exe has been copied to c:\hokus\pokus
echo done
echo Press any key to close this window
pause>nul
exit
There is a "name" file in c:\hokus
It contain the first and the last name.
Re: Can someone help me with this?!
Greetings Chinky20018,
This looks like a school\class assignment. If that's true, then post the code you have written thus far and the good folks here will be more than willing to help you.
Best wishes!
This looks like a school\class assignment. If that's true, then post the code you have written thus far and the good folks here will be more than willing to help you.
Best wishes!
-
- Posts: 104
- Joined: 28 Jul 2011 17:32
Re: Can someone help me with this?!
Ocalabob wrote:Greetings Chinky20018,
This looks like a school\class assignment. If that's true, then post the code you have written thus far and the good folks here will be more than willing to help you.
Best wishes!
What?
My answer didn't do it?
Re: Can someone help me with this?!
Ranguna173 wrote:Ocalabob wrote:Greetings Chinky20018,
This looks like a school\class assignment. If that's true, then post the code you have written thus far and the good folks here will be more than willing to help you.
Best wishes!
What?
My answer didn't do it?
... What kind of school teaches Batch?
-
- Posts: 104
- Joined: 28 Jul 2011 17:32
Re: Can someone help me with this?!
nitt wrote:Ranguna173 wrote:Ocalabob wrote:Greetings Chinky20018,
This looks like a school\class assignment. If that's true, then post the code you have written thus far and the good folks here will be more than willing to help you.
Best wishes!
What?
My answer didn't do it?
... What kind of school teaches Batch?
Why did you replied to me?
I never said it was school work..
Re: Can someone help me with this?!
I have the same class...and while I appreciate the response that gave the complete answer, I'd really like to explore and figure it out independently. What I came up with does everything the instructor gave in the directions except it shows the commands (item #6 in his list of directions) I cannot figure out what command to issue that will prevent the commands from showing, just the result of the commands. This is what I have written so far:
c:
cls
echo first name
echo last name
dir
md hokus
cd c:\hokus
md pokus
move %SystemRoot%\system32\notepad.exe pokus
dir c: /s
echo done
(Just so you'll know, I'm running the command in a virtual computer in VirtualBox running Windows XP)
Thanks!
c:
cls
echo first name
echo last name
dir
md hokus
cd c:\hokus
md pokus
move %SystemRoot%\system32\notepad.exe pokus
dir c: /s
echo done
(Just so you'll know, I'm running the command in a virtual computer in VirtualBox running Windows XP)
Thanks!
Re: Can someone help me with this?!
I finally (and embarrassingly) figured it out...use the @echo off command. Thanks everyone.
-
- Posts: 104
- Joined: 28 Jul 2011 17:32
Re: Can someone help me with this?!
theoldman wrote:I have the same class...and while I appreciate the response that gave the complete answer, I'd really like to explore and figure it out independently. What I came up with does everything the instructor gave in the directions except it shows the commands (item #6 in his list of directions) I cannot figure out what command to issue that will prevent the commands from showing, just the result of the commands. This is what I have written so far:
c:
cls
echo first name
echo last name
dir
md hokus
cd c:\hokus
md pokus
move %SystemRoot%\system32\notepad.exe pokus
dir c: /s
echo done
(Just so you'll know, I'm running the command in a virtual computer in VirtualBox running Windows XP)
Thanks!
Dude, it has been solved!
Ranguna173 wrote:Code: Select all
@echo off
cd c:\
if exist "hokus" (goto check) else (goto start)
:check
cd .\hokus
if exist name (
goto check_2
) else (
goto start
)
:check_2
< name (
set /p line1=
set /p line2=
)
goto start_a
:start
echo What is your first name?
set /p FN=
cls
echo What is your second name?
set /p SN=
cd c:\
md hokus
cd .\hokus
echo %FN%>name
echo %SN%>>name
set line1=%FN%
set line2=%SN%
:start_a
cls
echo %line1%
echo %line2%
echo The "hokus" folder has been done in c:\
cd c:\hokus
md pokus
echo The "pokus" folder has been done in c:\hokus
copy C:\Windows\System32\notepad.exe c:\hokus\pokus
echo The notepad.exe has been copied to c:\hokus\pokus
echo done
echo Press any key to close this window
pause>nul
exit
There is a "name" file in c:\hokus
It contain the first and the last name.
Re: Can someone help me with this?!
Thanks Ranguna173!
Re: Can someone help me with this?!
Ranguna173 wrote:Why did you replied to me?
I never said it was school work..
I was talking to Ocalabob. >.>
-
- Posts: 104
- Joined: 28 Jul 2011 17:32
Re: Can someone help me with this?!
theoldman wrote:Thanks Ranguna173!
You are welcome!
BTW you can find notepad in
C:\windows\system32\
There should be a notepad.exe there.
nitt wrote:I was talking to Ocalabob. >.>
Oh.
Ok!