天天看點

Windows指令提示符隐藏檔案/檔案夾(含AutohotKey腳本程式)隐藏檔案顯示檔案拓展AutohotKey腳本

Windows指令提示符隐藏檔案或檔案夾

  • 隐藏檔案
  • 顯示檔案
  • 拓展
  • AutohotKey腳本

隐藏檔案

attrib +s +h +檔案/檔案夾路徑
           

顯示檔案

attrib -s -h +檔案/檔案夾路徑
           

拓展

attrib指令:更改檔案屬性

可使用attrib /?檢視指令使用方法,如下:

C:/>attrib /?
顯示或更改檔案屬性。

ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [+O | -O] [+I | -I] [+X | -X] [+P | -P] [+U | -U]
       [drive:][path][filename] [/S [/D]] [/L]

  +   設定屬性。
  -   清除屬性。
  R   隻讀檔案屬性。
  A   存檔檔案屬性。
  S   系統檔案屬性。
  H   隐藏檔案屬性。
  O   脫機屬性。
  I   無内容索引檔案屬性。
   X   無清理檔案屬性。
  V   完整性屬性。
  P   固定屬性。
  U   非固定屬性。
  [drive:][path][filename]
      指定屬性要處理的檔案。
  /S  處理目前檔案夾及其所有子檔案夾中
      的比對檔案。
  /D  也處理檔案夾。
  /L  處理符号連結和
      符号連結目标的屬性
           

AutohotKey腳本

; Generated by AutoGUI 2.6.2
#SingleInstance Force
#NoEnv
SetWorkingDir %A_ScriptDir%
SetBatchLines -1

Gui Add, Button, gButton1 x25 y10 w100 h23, 檔案
Gui Add, Button, gButton2 x25 y45 w100 h23, 檔案夾
Gui Add, Button, gButton3 x25 y80 w100 h23, 顯示
Gui Add, Button, gButton4 x25 y115 w100 h23, 關于

Gui -MaximizeBox
Gui -MinimizeBox
Gui Show, w150 h150, 隐藏屬性
Return

Button1:
FileSelectFile OutputVar,,A_Desktop,選擇檔案
if OutputVar != 
{
    FileSetAttrib +SH,%OutputVar%
    SoundPlay, %A_WinDir%\Media\Windows Foreground.wav
}
Return

Button2:
FileSelectFolder OutputVar,A_Desktop,1,選擇檔案夾
if OutputVar != 
{
    FileSetAttrib +SH,%OutputVar%
    SoundPlay, %A_WinDir%\Media\Windows Foreground.wav
}
Return

Button3:
InputBox,InputVar,輸入路徑,,,400,100
if InputVar != 
{
    FileSetAttrib -SH,%InputVar%
    SoundPlay, %A_WinDir%\Media\Windows Foreground.wav  
} 
Return

Button4:
    Msgbox ,64,關于,隐藏有風險,操作需謹慎!`n操作成功後需手動重新整理一下!`n檔案/檔案夾被隐藏後,無法在資料總管找到(即使打開顯示屬性也看不到,僅指令行執行特殊指令可檢視),請務必記住檔案/檔案夾名稱!`n `nBy 冷月風華`n `n2020/5/6
return

GuiEscape:
GuiClose:
    ExitApp

           

繼續閱讀