2012-06-18 40 views

回答

1
use Win32::File qw(GetAttributes SetAttributes); 

my $qfn = "\\\\server\\share\\dir\\file"; 
# or: "//server/share/dir/file" 

GetAttributes($qfn, my $attrs) or die $^E; 
$attrs |= Win32::File::HIDDEN; 
SetAttributes($qfn, $attrs) or die $^E; 

Win32::File

注:

  • 它没有记录,但$^E应提供错误的错误消息。
  • Get-modify-set避免了对现有属性的破坏。
相关问题