Command.com programming
Moderator: Thanas
Command.com programming
I'm trying to write a program in Command.com to quickly rename all the files in a folder to something that is dependent upon the file name. Unfortunately, I only know how to use higher level languages, like Java and limited C++, so I'm having a rough time just trying to figure out how they do an IF statement. Does anyone know of a site where I can find the basics of the Comand.com language? I've tried Googling for it, but havne't turned up anything useful so far. Alternatively, is there a way to do this is Java?
"Well, it's too bad that thread pilots aren't allow to carry pistols.
Otherwise they would have stopped you." - Pablo Sanchez
Otherwise they would have stopped you." - Pablo Sanchez
Uou want to learn shell scripting? *shudder*
Better idea: get a copy of ActivePerl, and learn perl scripting. Alot more useful, and easier to learn. Plus, you can learn how to do CGI scripting as well...
EDIT: fixed typos...
Better idea: get a copy of ActivePerl, and learn perl scripting. Alot more useful, and easier to learn. Plus, you can learn how to do CGI scripting as well...
EDIT: fixed typos...
Last edited by Beowulf on 2004-01-17 03:10am, edited 1 time in total.
"preemptive killing of cops might not be such a bad idea from a personal saftey[sic] standpoint..." --Keevan Colton
"There's a word for bias you can't see: Yours." -- William Saletan
"There's a word for bias you can't see: Yours." -- William Saletan
- Crayz9000
- Sith Apprentice
- Posts: 7329
- Joined: 2002-07-03 06:39pm
- Location: Improbably superpositioned
- Contact:
It's called a DOS batch script, look it up. And the syntax that goes with it is HORRIBLY limited.
A Tribute to Stupidity: The Robert Scott Anderson Archive (currently offline)
John Hansen - Slightly Insane Bounty Hunter - ASVS Vets' Assoc. Class of 2000
HAB Cryptanalyst | WG - Intergalactic Alliance and Spoof Author | BotM | Cybertron | SCEF
John Hansen - Slightly Insane Bounty Hunter - ASVS Vets' Assoc. Class of 2000
HAB Cryptanalyst | WG - Intergalactic Alliance and Spoof Author | BotM | Cybertron | SCEF
I should go to bed soonish, but there's a reason why I recommended Perl for this task. It's designed to make this sort of thing easy.Crayz9000 wrote:It's called a DOS batch script, look it up. And the syntax that goes with it is HORRIBLY limited.
"preemptive killing of cops might not be such a bad idea from a personal saftey[sic] standpoint..." --Keevan Colton
"There's a word for bias you can't see: Yours." -- William Saletan
"There's a word for bias you can't see: Yours." -- William Saletan
Problem finished without having to resort to using batch scripts. Simply sent the list of files to a text file, using dir/b, then added 'rename' in front of them and added the new name of the files with the Replace command. I knew about the /w, and /p switches, but never knew about the /b... How many bloody switches does that simple command have?
"Well, it's too bad that thread pilots aren't allow to carry pistols.
Otherwise they would have stopped you." - Pablo Sanchez
Otherwise they would have stopped you." - Pablo Sanchez
- Crayz9000
- Sith Apprentice
- Posts: 7329
- Joined: 2002-07-03 06:39pm
- Location: Improbably superpositioned
- Contact:
dir /hStimNeuro wrote:Problem finished without having to resort to using batch scripts. Simply sent the list of files to a text file, using dir/b, then added 'rename' in front of them and added the new name of the files with the Replace command. I knew about the /w, and /p switches, but never knew about the /b... How many bloody switches does that simple command have?
I think.
A Tribute to Stupidity: The Robert Scott Anderson Archive (currently offline)
John Hansen - Slightly Insane Bounty Hunter - ASVS Vets' Assoc. Class of 2000
HAB Cryptanalyst | WG - Intergalactic Alliance and Spoof Author | BotM | Cybertron | SCEF
John Hansen - Slightly Insane Bounty Hunter - ASVS Vets' Assoc. Class of 2000
HAB Cryptanalyst | WG - Intergalactic Alliance and Spoof Author | BotM | Cybertron | SCEF
Heh, just started going through through the alphabet..
Valid: /a, /b, /c, /d, /l, /n, /o, /p, /q, /s, /t, /w, /x.
Note: Try /s. I thnk it does a dir on every folder on your drive.. or something. Either way, it goes on for almost a minute, switching directories on its own.
Why in the world do they have so many switches? Surely they have to have a purpose...
Valid: /a, /b, /c, /d, /l, /n, /o, /p, /q, /s, /t, /w, /x.
Note: Try /s. I thnk it does a dir on every folder on your drive.. or something. Either way, it goes on for almost a minute, switching directories on its own.
Why in the world do they have so many switches? Surely they have to have a purpose...
"Well, it's too bad that thread pilots aren't allow to carry pistols.
Otherwise they would have stopped you." - Pablo Sanchez
Otherwise they would have stopped you." - Pablo Sanchez
- Crayz9000
- Sith Apprentice
- Posts: 7329
- Joined: 2002-07-03 06:39pm
- Location: Improbably superpositioned
- Contact:
You would have thought that Microsoft would have realized the utility of a MAN command years ago. But noooo....
Anyway, I have an old DOS 3.0 book in one of my bookshelfs. I'll have to drag it out and have a look.
Anyway, I have an old DOS 3.0 book in one of my bookshelfs. I'll have to drag it out and have a look.
A Tribute to Stupidity: The Robert Scott Anderson Archive (currently offline)
John Hansen - Slightly Insane Bounty Hunter - ASVS Vets' Assoc. Class of 2000
HAB Cryptanalyst | WG - Intergalactic Alliance and Spoof Author | BotM | Cybertron | SCEF
John Hansen - Slightly Insane Bounty Hunter - ASVS Vets' Assoc. Class of 2000
HAB Cryptanalyst | WG - Intergalactic Alliance and Spoof Author | BotM | Cybertron | SCEF
Shit loadsStimNeuro wrote:How many bloody switches does that simple command have?
"dir /?" is a good starting point.
Infact for any microsoft command line application, "/?" is a good switch to try first.
copy & paste is so handy.DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]
[/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]
[drive:][path][filename]
Specifies drive, directory, and/or files to list.
/A Displays files with specified attributes.
attributes D Directories R Read-only files
H Hidden files A Files ready for archiving
S System files - Prefix meaning not
/B Uses bare format (no heading information or summary).
/C Display the thousand separator in file sizes. This is the
default. Use /-C to disable display of separator.
/D Same as wide but files are list sorted by column.
/L Uses lowercase.
/N New long list format where filenames are on the far right.
/O List by files in sorted order.
sortorder N By name (alphabetic) S By size (smallest first)
E By extension (alphabetic) D By date/time (oldest first)
G Group directories first - Prefix to reverse order
/P Pauses after each screenful of information.
/Q Display the owner of the file.
/S Displays files in specified directory and all subdirectories.
/T Controls which time field displayed or used for sorting
timefield C Creation
A Last Access
W Last Written
/W Uses wide list format.
/X This displays the short names generated for non-8dot3 file
names. The format is that of /N with the short name inserted
before the long name. If no short name is present, blanks are
displayed in its place.
/4 Displays four-digit years
Switches may be preset in the DIRCMD environment variable. Override
preset switches by prefixing any switch with - (hyphen)--for example, /-W.
"Okay, I'll have the truth with a side order of clarity." ~ Dr. Daniel Jackson.
"Reality has a well-known liberal bias." ~ Stephen Colbert
"One Drive, One Partition, the One True Path" ~ ars technica forums - warrens - on hhd partitioning schemes.
"Reality has a well-known liberal bias." ~ Stephen Colbert
"One Drive, One Partition, the One True Path" ~ ars technica forums - warrens - on hhd partitioning schemes.