Go Back   Computer Forums > Welcome To Computer Forums .org > Social Lounge | Off Topic
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 12-06-2009, 10:24 PM   #1
Fully Optimized
 
Jesusfrk611's Avatar
 
Join Date: Feb 2005
Location: US
Posts: 2,193
Default command prompt batch files help

I have a class on command prompt in college. I'm on my last week finally. But I need to finish up 1 last assignment, and it's on batch files. I'm completely stumped.

Here's the question
Create a batch files called dd.bat. This batch file should display the files on the root of the disk (insert disk of your own, we use a floppy disk with all our assignments on it, but what is on it isn't important) in date order with the most current date displayed first, and should pause so that the user may view the display one screen full at a time. Document your name, name of batch file, and date.

I can do most of this stuff outside of a batch file, but putting it all together to make it work in a batch file...not getting it... I've been doing trial and error for awhile and can't figure out crap. We have a book with info for the chapter, but it doesn't seem to have the answers I need...

Thought I might throw that out there in case anyone knows command prompt that can help me out. Thanks.
__________________

Jesusfrk611 is offline   Reply With Quote
Old 12-06-2009, 11:31 PM   #2
Fully Optimized
 
vampist's Avatar
 
Join Date: Oct 2008
Location: USA
Posts: 2,404
Default Re: command prompt batch files help

DIR /O:-D /P <insert directory you want to search>

EDIT: I suppose I should explain what this does...

DIR searches and lists directories and files.
/O puts them in a search order of D which is by date.
To have them list newest first you must reverse the order.
That is what the - does.
/P pauses

All you need to do is insert the directory.


EDIT2: If you want ALL of the directories and files listed then you must add /S
If you want JUST files then add /A:-D with no /S

I guess all those years of batch file wars with friends paid off xD
__________________

__________________
Everyone's Favorite Turd xD
ET: "Phone home!"
Geek: "ping 127.0.0.1"

"If that guy knew half the $h*t that I know, his fuzzy little head would explode. " - Matthew Farrell
vampist is offline   Reply With Quote
Old 12-06-2009, 11:51 PM   #3
Fully Optimized
 
Jesusfrk611's Avatar
 
Join Date: Feb 2005
Location: US
Posts: 2,193
Default Re: command prompt batch files help

Nice, it worked! lol, I dunno why that was so hard. I was trying to use the sort command in it and couldn't figure out how to sort the Directory of A:\ in the batch file for the life of me. I didn't pay close enough attention in that class except to just get through it... I did get to the /O on the DIR command at one point, but never got the -D. Thanks a bunch.
Jesusfrk611 is offline   Reply With Quote
Old 12-06-2009, 11:53 PM   #4
Fully Optimized
 
vampist's Avatar
 
Join Date: Oct 2008
Location: USA
Posts: 2,404
Default Re: command prompt batch files help

I do the same in many of my classes haha. You're welcome.
__________________
Everyone's Favorite Turd xD
ET: "Phone home!"
Geek: "ping 127.0.0.1"

"If that guy knew half the $h*t that I know, his fuzzy little head would explode. " - Matthew Farrell
vampist 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 07:44 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