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


 

沒有留言:

張貼留言

只要點兩下兩次,就能依照設定拆分指定PDF頁數並合併成設定好的一個PDF

        最近遇到一個問題,想要對四個不同的PDF,分別擷取1~2頁、3~4頁、5~6頁、7~8頁,合併成一個總共8頁的PDF。那該怎麼寫程式來處理這件事呢?那如果是用線上拆分PDF網頁與線上合併PDF網頁,該怎麼做呢?則是需要將四個不同PDF分別上傳到拆分網頁後再 一頁一...