Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 09-27-2010, 09:58 PM   #1
Solid State Member
 
Join Date: Sep 2010
Posts: 17
Default Question

At the command prompt, enter a Single Command that will rename the file ALPHABET.TXT in the C:\MYFILES directory to ABC.TXT--------------how would i go about doing that?
__________________

copelandtml is offline   Reply With Quote
Old 09-28-2010, 04:40 AM   #2
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,006
Default Re: Question

move alphabet.txt c:\myfiles\abc.txt

put that in a batch file and call it abcmove.bat
__________________

__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 09-28-2010, 12:14 PM   #3
Solid State Member
 
Join Date: Sep 2010
Posts: 17
Default Re: Question

Thanks a lot, would you mind explaining how to perform a few other tasks inside the command prompt. New to programming, if you don't have the time i'll just keep playing around.

1------At the command prompt, enter a Single Command that will MARK the file HIDEME.TXT as a HIDDEN, and READONLY file. (The file is in the C:\MYFILES directory)

2------At the command prompt, enter a Single Command that will move the files FILE1.TXT, FILE2.TXT and FILE3.TXT from the C:\MYFILES directory to the C:\MYFILES\DATA directory. NOTE: You may use * wildcard in this command.

3------At the command prompt, enter a Single Command that will move the files FILE1.TXT, FILE2.TXT and FILE3.TXT from the C:\MYFILES directory to the C:\MYFILES\DATA directory. NOTE: You may use * wildcard in this command.

4------At the command prompt, enter a Single Command that will satisfy all of the following criteria:
Copy the contents of the C:\MYFILES directory into a directory called C:\BACKUP\MYFILES
Include all the subdirectories, including the empty ones
Copies all files, including hidden and system files
Display the source and destination filenames while copying
copelandtml is offline   Reply With Quote
Old 09-29-2010, 11:53 AM   #4
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,006
Default Re: Question

it really depends what you want to do in the command prompt.

there is a ton of stuff that you *can* do, but it's all pretty useless if you have no application for doing those things.

basically, you're just running programs from the command line, that could either start a graphical interface, or it could send back a line or a screen of text.

for example, you type dir and a list of the files in the current directory comes back.

type copy (file) (destination) and you copy a file that you specify to a destination
type move (file) (destination and you move a file

type tasklist and you get a list of running processes.


what other tasks do you have in mind?
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 09-29-2010, 12:35 PM   #5
Solid State Member
 
Join Date: Sep 2010
Posts: 17
Default Re: Question

Yeah, I've been learning some of the commands in the prompt, prof kinda jumped a few steps. I'm just playing around trying to figure stuff out, the code needs to be perfect to run, gets a little frustrating. The following are the other tasks I'm trying to figure out.

1------At the command prompt, enter a Single Command that will MARK the file HIDEME.TXT as a HIDDEN, and READONLY file. (The file is in the C:\MYFILES directory)

2------At the command prompt, enter a Single Command that will move the files FILE1.TXT, FILE2.TXT and FILE3.TXT from the C:\MYFILES directory to the C:\MYFILES\DATA directory. NOTE: You may use * wildcard in this command.

3------At the command prompt, enter a Single Command that will move the files FILE1.TXT, FILE2.TXT and FILE3.TXT from the C:\MYFILES directory to the C:\MYFILES\DATA directory. NOTE: You may use * wildcard in this command.

4------At the command prompt, enter a Single Command that will satisfy all of the following criteria:
Copy the contents of the C:\MYFILES directory into a directory called C:\BACKUP\MYFILES
Include all the subdirectories, including the empty ones
Copies all files, including hidden and system files
Display the source and destination filenames while copying
copelandtml is offline   Reply With Quote
Old 09-30-2010, 06:25 AM   #6
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: Question

For 1), have a look at the attrib command. The others you should be able to find pretty easily with a bit of research.
__________________
Save the whales, feed the hungry, free the mallocs.
berry120 is offline   Reply With Quote
Old 09-30-2010, 10:19 AM   #7
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,006
Default Re: Question

yes, the attrib command, attrib -a to set the archive bit.
attrib -h to hide
attrib -r to set to read only.

if your at a directory (c:\myfiles) you could type move c:\myfiles* c:\yourfiles and it'll move everything.

you could use the * wild card but that's a broad wildcard .

say you have files
file1.txt
file2.txt
file3.txt
file1.bmp
file1-copy.txt
readme.txt

if you type copy * it'll copy all the text files
if you type copy *.txt it'll copy all the text files
if you type copy file*.txt file it'll copy all the files that are text files where the file name starts text. (file1.txt, file2.txt, file3.txt file1-copy.txt)

if you type copy file?.txt it'll copy all the text files that are text where the file name starts with file, then has one charecter then a dot and txt (file1.txt, file2.txt, file3.txt)

you could use copy file[0-9].txt and it'll copy all files where the name starts file, then has a character in the range 0 - 9 and has a .txt file extension.


for the last one. check out xcopy...

at the command line type xcopy /? and you;ll see all the options.
__________________

__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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



All times are GMT -5. The time now is 04:21 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0