I prefer to ask Windows about where the stuff is instead of guessing myself, but on the other side, knowledge about these functions is well-buried in the MSDN (and in the dark recesses of my mind, back from the days when I programmed a low level language).
The Windows System directory (C:/WINNT and/or C:/WINDOWS or wherever your admin chose to install it. Note that you can have C:/WINDOWS on an NT machine even when not changing the defaults if you upgrade from Win9x or Win311 to Windows NT...). The code as posted isn't completely correct though, it won't work (or I think that it won't) under Win32s, as there is no kernel32.exe there. So some checks should be added before loading Win32::API.
use Win32::API; my $GetWindowsDirectory = new Win32::API( "KERNEL32","GetWindowsDirectoryA","PN","N" ); sub GetWindowsDirectory { my $buffer = "\0" x 255; $GetWindowsDirectory->Call($buffer,length $buffer); $buffer =~ tr/\0//d; return $buffer; }; print GetWindowsDirectory();
I'm still searching for the information on how to get at the directories for the Desktop, the Program Files and other stuff, but I guess this will be found within the next hour and then posted as an update to this node. These paths are stored in the registry somewhere, but taking them straight out of there is considered bad manners - you are supposed to obtain them via some Windows API call.
Update: The call in question is SHGetSpecialFolderLocation - I'll try out the prototype and post it soon.
perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
In reply to Re: Determine Standard Windows Paths
by Corion
in thread Determine Standard Windows Paths
by demerphq
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |