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


 

沒有留言:

張貼留言

Laravel 12 Model 資料庫中的資料表,並提供與資料庫互動的介面

相關系列文章: 1. 在 windows 10 安裝 laravel 12 studentManagement環境與設定 2. laravel 12 route 路由 3. laravel 12 Blade Templates 網頁模版 4. laravel 12 Control...