找回密码
 加入
搜索
查看: 1856|回复: 6

[系统综合] 如何判断文件的属性是否为隐藏属性!

  [复制链接]
发表于 2012-5-13 12:22:52 | 显示全部楼层 |阅读模式
$hSearch = FileFindFirstFile(@DesktopDir & "\*.lnk")

While 1
Sleep(100)
$sFile = FileFindNextFile($hSearch)
$FilePath = FileGetShortcut(@DesktopDir & '\' & $sFile)
If $FilePath[0] = 'C:\1.exe' Then FileSetAttrib(@DesktopDir & '\' & $sFile, '+H')
Sleep(100)
WEnd

以上是获取 程序 在桌面生成的快捷方式,但是文件属性如果本来就为隐藏的话 就会 显示   非数组变量使用下标 , 如何改成先判断!
发表于 2012-5-13 12:30:55 | 显示全部楼层
FileGetAttrib
发表于 2012-5-13 12:37:42 | 显示全部楼层
If $FilePath[0] = 'C:\1.exe' Then
        IF Not StringInStr(FileGetAttrib(@DesktopDir & '\' & $sFile), "H") Then
                FileSetAttrib(@DesktopDir & '\' & $sFile, '+H')
        EndIf
EndIf
 楼主| 发表于 2012-5-13 13:56:46 | 显示全部楼层
楼上的无法改成让他循环监视吗?
发表于 2012-5-13 14:05:10 | 显示全部楼层
你就不能自己 改改 放到循环里去 ? 这么喜欢伸手要现成的?
 楼主| 发表于 2012-5-13 14:30:33 | 显示全部楼层
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_Outfile=111111111.exe
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****

$hSearch = FileFindFirstFile(@DesktopDir & "\*.lnk")

While 1
    $sFile = FileFindNextFile($hSearch)
    $FilePath = FileGetShortcut(@DesktopDir & '\' & $sFile)

If $FilePath[0] = 'C:\1.exe' Then
        IF Not StringInStr(FileGetAttrib(@DesktopDir & '\' & $sFile), 'H') Then
                FileSetAttrib(@DesktopDir & '\' & $sFile, '+H')
                               
        EndIf
        EndIf
       
sleep(100)
Wend






出错。。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2012-5-14 11:21:26 | 显示全部楼层
回复 6# razc


   那么简单的数组变量未定义,你这伸手党……换一个变量或者定义数组……
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-20 13:40 , Processed in 0.081733 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表