@echo off & setlocal enabledelayedexpansion
set "LogFile=%appdata%\PermissaoArquivos.log"
set "Folders=Desktop,Documents,Pictures,Music,Videos
if not exist "!LogFile!" type nul >"!LogFile!" & goto :_apply_:
Rem Execute outros commandos, existe o arquivo: "!LogFile!"^^!
Rem Aqui entra seus outros commandos...
goto :eof
:_apply_:
echo Iniciando o processo em !DATE! !TIME! >>"!LogFile!"
for %%i in (%systemdrive%%homepath%\ %OneDriveCommercial%\ ) do (
for %%I in (!Folders!) do set "_Path_Folder=%%~i%%~I"
call :_deny_:
)
echo/Bloqueio de exclusao de diretorios do OneDrive aplicado em !DATE! as !TIME!>>"!LogFile!"
goto :eof
:_deny_:
icacls "!_Path_Folder!" /deny Todos:(de) >>"!LogFile!" && exit /b
echo/ error: "!_Path_Folder!" & timeout /t -1 & goto :eof
@echo off & setlocal enabledelayedexpansion
set "LogFile=%appdata%\PermissaoArquivos.log"
set "Folders=Desktop,Documents,Pictures,Music,Videos
if not exist "!LogFile!" type nul >"!LogFile!" & goto :_apply_:
Rem Execute outros commandos, existe o arquivo: "!LogFile!"^^!
Rem Aqui entra seus outros commandos...
goto :eof
:_apply_:
echo Iniciando o processo em !DATE! !TIME! >>"!LogFile!"
for %%i in (%systemdrive%%homepath%\ %OneDriveCommercial%\ ) do (
for %%I in (!Folders!) do set "_Path_Folder=%%~I%%~I"& call :_deny_:
)
echo/Bloqueio de exclusao de diretorios do OneDrive aplicado em !DATE! as !TIME!>>"!LogFile!"
goto :eof
:_deny_:
icacls "!_Path_Folder!" /deny Todos:^(de^) >>"!LogFile!" && exit /b
echo/ error: "!_Path_Folder!" & timeout /t -1 & goto :eof
@echo off & setlocal enabledelayedexpansion
set LogFile=%appdata%\PermissaoArquivos.log
if not exist %LogFile% (
echo Iniciando o processo em %DATE% %TIME% >> %LogFile%
icacls %systemdrive%%homepath%\Documents /deny Todos:^(de^) >> %LogFile%
icacls %systemdrive%%homepath%\Pictures /deny Todos:^(de^) >> %LogFile%
icacls %systemdrive%%homepath%\Music /deny Todos:^(de^) >> %LogFile%
icacls %systemdrive%%homepath%\Videos /deny Todos:^(de^) >> %LogFile%
icacls %systemdrive%%homepath%\Desktop /deny Todos:^(de^) >> %LogFile%
icacls "%OneDriveCommercial%\Desktop" /deny Todos:^(de^) >> %LogFile%
icacls "%OneDriveCommercial%\Documents" /deny Todos:^(de^) >> %LogFile%
icacls "%OneDriveCommercial%\Pictures" /deny Todos:^(de^) >> %LogFile%
icacls "%OneDriveCommercial%\Music" /deny Todos:^(de^) >> %LogFile%
icacls "%OneDriveCommercial%\Videos" /deny Todos:^(de^) >> %LogFile%
echo Bloqueio de exclusao de diretorios do OneDrive aplicado em %DATE% as %TIME% >> %LogFile%