2021年3月25日 星期四

只要會用滑鼠點兩下,一鍵設定電腦主機內機敏性資料夾或檔案隱藏或加密

        在電腦教室學生機設定禁止學生瀏覽某些網站。希望能夠隱藏、加密與禁止修改檔案屬性。以保護檔案的安全。當然用RouterOS在閘道限制更快。目前只想到保護檔案或資料夾的應用。
要注意的是資料夾隱藏特別是系統資料夾,需要的是系統管理員的權限

功能:隱藏檔案hosts
檔案名稱:HideFileHosts.bat
內容:
@echo off
attrib %WinDir%\System32\drivers\etc\hosts +h

功能:不隱藏檔案hosts
檔案名稱:ShowFileHosts.bat
內容:
@echo off
attrib %WinDir%\System32\drivers\etc\hosts -h

功能:隱藏資料夾etc
檔案名稱:HideFolderEtc.bat
內容:
@echo off
REM :: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
REM :: BatchGotAdmin (Run as Admin code ends)
REM :: Your codes should start from the following line
@echo off
attrib %WinDir%\System32\drivers\etc +h

功能:不隱藏資料夾etc
檔案名稱:ShowFolderEtc.bat
內容:
@echo off
REM :: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
REM :: BatchGotAdmin (Run as Admin code ends)
REM :: Your codes should start from the following line
@echo off
attrib %WinDir%\System32\drivers\etc -h


 

沒有留言:

張貼留言

只要點兩下,就可以將資料夾input內的所有Word通通轉成一個PDF

系列文章: 1. python 不管何時何地,只要點兩下,資料夾內的所有pdf都會合併成一個pdf https://skjhcreator.blogspot.com/2022/06/pythonpdfpdf.html 2. python 只要點兩下,分別對各資料夾內的pdf合併,...