http://www.cnblogs.com/royenhome/archive/2010/07/21/1782019.html
1、獲取操作系統版本信息
1 use Win32;
2 use strict;
3 ($OS_string, $OS_major, $OS_minor, $OS_build, $OS_id) = Win32::GetOSVersion();
2 use strict;
3 ($OS_string, $OS_major, $OS_minor, $OS_build, $OS_id) = Win32::GetOSVersion();
2、獲取系統目錄
1 my $systemdir= Win32::GetFolderPath(0x0025) if(Win32::GetFolderPath(0x0025));
在xp系統下$systemdir的變量值爲C:\Windows\System32
3、獲取Windows目錄
1 our $windir = Win32::GetFolderPath(0x0024) if(Win32::GetFolderPath(0x0025));
在本人xp系統下$windir的變量值爲C:\WINDOWS
4、獲取系統所在的磁盤驅動號
1 our $rootdir= $ENV{SYSTEMDRIVE} if($ENV{SYSTEMDRIVE});
在本人xp系統下$rootdir的變量值爲C:,因爲我機器操作系統裝在C盤
5、獲取執行程序當前目錄
1 our $currentdir = Win32::GetCwd() if(Win32::GetCwd);
6、獲取用戶的document文件夾
1 our $alldocuments = Win32::GetFolderPath(0x002e) if(Win32::GetFolderPath(0x002e));
在本人xp系統下, $documents的變量值爲C:\Documents and Settings\All Users\Documents
7、獲取臨時文件夾目錄
1 our $tempdir = $ENV{TEMP} if($ENV{TEMP});
8、獲取當前用戶啓動文件夾目錄
1 our $mystartup = Win32::GetFolderPath(0x0007) if(Win32::GetFolderPath(0x0007));
9、獲取所用用戶啓動文件夾目錄
1 our $allstartup = Win32::GetFolderPath(0x0018) if(Win32::GetFolderPath(0x0018));
10、獲取Program Files文件夾目錄
1 our $programdir = Win32::GetFolderPath(0x0026) if(Win32::GetFolderPath(0x0026));
11、獲取AppData文件夾目錄
1 our $myappdata = Win32::GetFolderPath(0x001a) if(Win32::GetFolderPath(0x001a));
12、獲取Desktop文件夾目錄
1 our $mydesktop = Win32::GetFolderPath(0x0010) if(Win32::GetFolderPath(0x0010));
13、獲取當前用戶Favorite文件夾目錄
1 our $myfavorites = Win32::GetFolderPath(0x0006) if(Win32::GetFolderPath(0x0006));
14、獲取所有用戶的Favorite文件夾目錄
1 our $allfavorites = Win32::GetFolderPath(0x001f) if(Win32::GetFolderPath(0x001f));
15、獲取啓動菜單文件夾目錄
1 our $mystartmenu = Win32::GetFolderPath(0x000b) if(Win32::GetFolderPath(0x000b));
16、獲取計算機名稱
1 our $computername = Win32::NodeName() if(Win32::NodeName());
17.、獲取當前系統登錄用戶名
1 our $username = Win32::LoginName() if(Win32::LoginName());