Ms windows

From campisano.org
Jump to navigation Jump to search

Commands


Permissions


Services

How to disable windows updates in windows 10

  • disable windows update in services.msc
  • set your connection as a "metered connection"

Links:


Backup rotate

:: [CMP] from http://www.sprint.net.au/~terbut/usefulbox/apachelogrot.htm

:: plesk scheduler runs tasks on C:\Windows\system32 !!!
cd C:\tmp



:: ========================================================
:: input variables and datetime
:: ========================================================

@if "%1" == "" goto USAGE

@set /a noatk=%1
@set PATH_TO_ROTATE=%2
@set FILESUFFIX=%3

@echo CD = %CD%
@echo NUM = %noatk%
@echo PATH_TO_ROTATE = %PATH_TO_ROTATE%
@echo FILESUFFIX = %FILESUFFIX%

@if "%noatk%" == 0 goto USAGE
@if "%PATH_TO_ROTATE%" == "" goto USAGE
@if "%FILESUFFIX%" == "" goto USAGE



:: ========================================================
:: rotate the zip files
:: ========================================================

:: make list of archive zip files
@type NUL > %PATH_TO_ROTATE%_arclist.txt
@for /F "tokens=1,2 delims=[] " %%i in ('dir /B /OD
%PATH_TO_ROTATE%\*%FILESUFFIX% ^| find /N "%FILESUFFIX%"') do @echo
%%i = %%j>> %PATH_TO_ROTATE%_arclist.txt
@if ERRORLEVEL 1 ( set ERRORLOG=cmd: dir &goto ERROR )
pause
:: count total number of files
@for /F "tokens=1 delims=" %%i in ('type %PATH_TO_ROTATE%_arclist.txt
^| find /C "%FILESUFFIX%"') do @set tnof=%%i
@if ERRORLEVEL 1 ( set ERRORLOG=cmd: find1 &goto ERROR )
pause
:: setup for and create the deletion list
@set /a negtk=%noatk%*-1
@set /a tntd=%tnof% - %noatk%
pause
@type NUL>%PATH_TO_ROTATE%_dellist.txt
@for /L %%i in (%negtk%,1,%tntd%) do @find " %%i = "
%PATH_TO_ROTATE%_arclist.txt >> %PATH_TO_ROTATE%_dellist.txt
@if ERRORLEVEL 1 ( set ERRORLOG=cmd: find2 &goto WARNING )
pause
:: del the old files
@for /F "tokens=3 delims= " %%i in ('find "%FILESUFFIX%"
%PATH_TO_ROTATE%_dellist.txt') do del /Q %PATH_TO_ROTATE%\%%i
@if ERRORLEVEL 1 ( set ERRORLOG=cmd: del /Q &goto ERROR )
pause
:: remove temp files
@del /Q %PATH_TO_ROTATE%_arclist.txt
@del /Q %PATH_TO_ROTATE%_dellist.txt



:: ========================================================
:: Program termination
:: ========================================================

@goto OK

:USAGE
@echo Usage: %0 ^<numFileToKeep^> ^<pathToRotate^> ^<fileSuffix.ext^>
@exit /b 1

:ERROR
@echo Process aborted!!!: %ERRORLOG%
@exit /b 1

:WARNING
@echo Process end with warning: %ERRORLOG%
@exit /b 0

:OK
@echo Process complete.
@exit /b 0