Welcome to Eyes on FF!
>>> Click here to download Final Fantasy Ringtones
Oh no!
 

Post New Thread  Reply
 
LinkBack Thread Tools
Citizen Bleys
Ukrainophile
Citizen Bleys's Avatar
Location: Chateau d'Oraguille
#1
Default DOS problem

Anybody know how to test if a replaceable parameter is a directory? if exist %1 returns true only if %1 is a file, not a directory.

I need to write a batch file that reacts differently if %1 represents a null, a file, a directory, or anything else (i.e., if it's not "", and it's not a file or directory, it creates a new direcotory named %1)

Also, anybody know how to extract filenames from a dir statement? I have to write another batch file which uses TYPE to display the contents of all read-only files.
i.e.

:startloop
if "%1" == "" goto end
type %1
shift
goto startloop

:end
Old 11-20-2001, 07:33 PM
Reply With Quote
Citizen Bleys is offline  
KatanaSoul
Guest
Default

For the directory vs file thing, I can only think to try cd %1 and test for an errorlevel.

I don't think DOS supported any sort of regular expressions or output manipulation. I'd just as soon try it in C.

In newer DOS versions, dir /b will show filenames plain, 1 per line. Type dir /? for details.
Old 11-22-2001, 08:17 AM
Reply With Quote
 
Citizen Bleys
Ukrainophile
Citizen Bleys's Avatar
Location: Chateau d'Oraguille
Default

It's for school. We're not allowed to use real programming languages in the "batch files" section
Old 11-22-2001, 07:36 PM
Reply With Quote
Citizen Bleys is offline  
God
Default

I don't know of any batch command that'd let you check a parameter for filetype / directory. Why would you want to? Is it some sort of assignment?

You can use DOSKEY to create a macro to overload what certain commands do, I think. Like you could overload "dir" to always mean "dir /s /w" or something. It's a way people used to save time, by not having to type all the commonly used switches every time they used a command. You could write a batch file that loads all the DOSKEY macros you need. I don't know if that helps. It's been awhile since I tried anything like that.
Old 11-25-2001, 05:37 AM
Reply With Quote
God is offline  
Citizen Bleys
Ukrainophile
Citizen Bleys's Avatar
Location: Chateau d'Oraguille
Default

Yeah, it was for a school assignment. But never mind, I passed that module, with honors, I think, even though I slaiked that assignment.

After using bash, I don't like DOS as much as I used to. DOSKEY is fine, but bash does all that without having to load a TSR. Yes, including macros. (alias lw='ls -F' is a good one)
Old 11-25-2001, 07:35 AM
Reply With Quote
Citizen Bleys is offline  
Post New Thread  Reply


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 On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:09 PM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.0.0
Copyright ©2000 - 2007, Eyes on Final Fantasy.
Sean Robinson Design