Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Re: Getting list of drives on pc

by dze27 (Pilgrim)
on Apr 16, 2003 at 21:58 UTC ( #251062=note: print w/replies, xml ) Need Help??

in reply to Re: Getting list of drives on pc
in thread Getting list of drives on pc

I do have a Windows box to test it on and it looks like this largely works. A couple of notes though. My floppy drive is A:, and it brought up a message (twice! and I cancelled both times) indicating that there was no disk in the A: drive. This would be awkward for a non-interactive user. Second thing, my CD drive is D:, and it completely skipped over that when the drive was empty, not recognizing it at all. No error message, no nothing. However, with a CD in the drive, it recognized it the same was as for all the fixed drives. So, caveat emptor with removable-media drives.

Replies are listed 'Best First'.
Re: Re: Re: Getting list of drives on pc
by belden (Friar) on Apr 16, 2003 at 23:03 UTC
    Many Windows installations have A:\ and B:\ aliased to the
    floppy drive, which is probably why you got the message 2x.

    setenv EXINIT 'set noai ts=2'

Re^3: Getting list of drives on pc
by Coruscate (Sexton) on Apr 16, 2003 at 23:03 UTC

    Ah yes, I could have told you about the not recognizing the empty drive. It will only return a list of drives that currently have a filesystem mounted on it. It simply tries to open the root directory of the drive, and if executed successfully, adds it to the list. As for the alert telling you about the empty floppy drive, this I could have expected but did not see in my use of that snippet. I believe it's because I used it in a CGI script ;)

    If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, please reply to this node or /msg me to inform me as to what is wrong with the post, so that I may update the node to the best of my ability.

Re^3: Getting list of drives on pc (no prompting)
by tye (Sage) on Apr 17, 2003 at 15:17 UTC

    You can control whether trying to access an empty drive prompts the user. See Win32API::File's SetErrorMode() for details.

                    - tye

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://251062]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2021-10-19 06:38 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (76 votes). Check out past polls.