Printable Version | Subscribe | Add to Favourites
New Topic New Poll New Reply
Author: Subject: DOS Help
liam.mccaffrey

posted on 20/8/09 at 02:08 PM Reply With Quote
DOS Help

Can anyone help me decipher this script?

@echo off
dir %1 /-p /o:gn > "Directory Listing.txt"

exit

I know it generates a text file of the files in the directory in which it finds itself.

what do the %1 and /o:gn do?

thanks





Build Blog
Build Photo Album

View User's Profile View All Posts By User U2U Member
Madinventions

posted on 20/8/09 at 02:14 PM Reply With Quote
The %1 is a command line parameter, so the user would type something like 'dir c:' and the script would replace the %1 with 'C:'.

/-p means do not pause after each screen of information.
/o lists the files in the given order. In this case, the given order is 'gn' which means 'Group directories first, then by name'.
Finally, the '>' means route the output somewhere other than the screen - in this case it goes to your text file.

I love DOS and still use batch files like this every day!

In WinXP, click Start, then Run and type in 'cmd' into the box. This will give you a DOS box. Now type 'dir /?' and you will get a list of all the options for the dir command.

Best regards,
Ed.

View User's Profile Visit User's Homepage View All Posts By User U2U Member
m8kwr

posted on 20/8/09 at 02:15 PM Reply With Quote
/o which puts directories in a specified order

:n which sorts by name, alphabetically

:g which sorts with subdirectories appearing first

HTH

View User's Profile View All Posts By User U2U Member
Madinventions

posted on 20/8/09 at 02:17 PM Reply With Quote
Oh, if you wanted just a list of files rather than all of the othe time and date info too, you could put a /b into the file.

dir %1 /b /-p /o:gn > "Directory Listing.txt"

HTH,
Ed.

View User's Profile Visit User's Homepage View All Posts By User U2U Member
liam.mccaffrey

posted on 20/8/09 at 02:21 PM Reply With Quote
thank you very much, i like them too

I would to use them more often





Build Blog
Build Photo Album

View User's Profile View All Posts By User U2U Member
MikeR

posted on 20/8/09 at 03:56 PM Reply With Quote
I clicked on this link as I spent last week writing dos batch files in XP.

Reminds me of the old days and there are only a few of us left who can do it at my place. (ok, maybe thats a few who are prepared to do it).

Today .... i've been installing BUGZILLA! woohoo (the main bit of the whoohoo is the fact in 5 hours in between my normal work I've got it installed where as one of my colleagues failed solidly over 3 days )

geeks rule!

View User's Profile View All Posts By User U2U Member
MikeRJ

posted on 20/8/09 at 03:59 PM Reply With Quote
quote:
Originally posted by MikeR
Today .... i've been installing BUGZILLA! woohoo (the main bit of the whoohoo is the fact in 5 hours in between my normal work I've got it installed where as one of my colleagues failed solidly over 3 days )



He needs to raise this issue on the bug tracking system. Oh wait...

View User's Profile View All Posts By User U2U Member
stevebubs

posted on 20/8/09 at 06:27 PM Reply With Quote
quote:
Originally posted by MikeR
I clicked on this link as I spent last week writing dos batch files in XP.

Reminds me of the old days and there are only a few of us left who can do it at my place. (ok, maybe thats a few who are prepared to do it).

Today .... i've been installing BUGZILLA! woohoo (the main bit of the whoohoo is the fact in 5 hours in between my normal work I've got it installed where as one of my colleagues failed solidly over 3 days )

geeks rule!


Mike,

have you had play with MS' Powershell yet?

View User's Profile E-Mail User View All Posts By User U2U Member
Agriv8

posted on 20/8/09 at 07:48 PM Reply With Quote
Had to look up the switch commands up but starting to show my age when i will still get a machines IP details from dos.

PS 1 I found the other day ping with a -t switch ( continuous ) fire 3 or 4 of these of on a test machine while doing networky stuff absoloute godsend.

PS my wife has just called me a nerd !!! Yup and proud !!

Regards

Agriv8





Taller than your average Guy !
Management is like a tree of monkeys. - Those at the top look down and see a tree full of smiling faces. BUT Those at the bottom look up and see a tree full of a*seholes .............


View User's Profile View All Posts By User U2U Member
maxey74

posted on 20/8/09 at 08:05 PM Reply With Quote
I too am old, and as such, an utter command line whore! It has a certain cool factor though, at least it does if you're a professional geek, like me

Some fairly technical guys here by the looks of it... Assuming some of you work in IT?

View User's Profile View All Posts By User U2U Member
stevebubs

posted on 20/8/09 at 08:32 PM Reply With Quote
quote:
Originally posted by Agriv8
Had to look up the switch commands up but starting to show my age when i will still get a machines IP details from dos.

PS 1 I found the other day ping with a -t switch ( continuous ) fire 3 or 4 of these of on a test machine while doing networky stuff absoloute godsend.

PS my wife has just called me a nerd !!! Yup and proud !!

Regards

Agriv8


For ping tests, go and get pingplotter ...

View User's Profile E-Mail User View All Posts By User U2U Member
David Jenkins

posted on 20/8/09 at 09:16 PM Reply With Quote
I recently wrote a DOS batch script that did a particular copying job - my office is full of ace C# programmers aged between 25 & 35, and none of them had seen it done before (which I found hard to believe, but there you go). They were all set to write a bit of code to do the same job, and I'd done it in 10 minutes...

If like me you run a Linux box at home then the command line holds no fears, especially when you remember that MS-DOS is only emasculated UNIX.

Another proud nerd!






View User's Profile Visit User's Homepage View All Posts By User U2U Member
MikeR

posted on 20/8/09 at 10:57 PM Reply With Quote
Ok, wrote a batch file last week that .....

Scanned running processes and terminated one if it was running,

Scanned running "at" jobs (scheduled jobs) removed the ones i didn't want and replaced them with new jobs.

oh and it also renamed a file and took a setting out of the registry.

I was happy and so was my customer that it didn't involve c / delphi code changes as that would have to go through a different process & take time / incur costs.

Stevebubs - i haven't played with powershell much at all, one of the 'old school' lads runs out entire build machine on it. Does some pretty nifty stuff by all accounts.

Technically i'm not a geek, i'm a project & support manager. I just have a geek background (ex developer) and still love getting my hands dirty.

View User's Profile View All Posts By User U2U Member

New Topic New Poll New Reply


go to top






Website design and SEO by Studio Montage

All content © 2001-16 LocostBuilders. Reproduction prohibited
Opinions expressed in public posts are those of the author and do not necessarily represent
the views of other users or any member of the LocostBuilders team.
Running XMB 1.8 Partagium [© 2002 XMB Group] on Apache under CentOS Linux
Founded, built and operated by ChrisW.