Voorbeelden van opstartscripts

Laatst bijgewerkt op 6 juni 2022

Bekijk de volgende voorbeelden om te leren hoe u typische defragmentatietaken tijdens het opstarten uitvoert.

Standaard aangepast opstarttijdscript

Standaard gebruikt UltraDefrag het volgende script als het aangepaste opstarttijdscript:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
@echo off
::
:: UltraDefrag - a powerful disk defragmenter for Windows.
::
:: ud-boot-time-custom.cmd - custom script for boot time defragmentation.
::
:: Visit https://en.wikibooks.org/wiki/Windows_Batch_Scripting
:: for general information about the script syntax.
::
:: Refer to the UltraDefrag CLI section of UltraDefrag documentation
:: at https://https://ultradefrag.net/support/ultradefrag-cli/
:: for detailed information about the `udefrag` command and environment
:: variables controlling its behaviour.
::
:: Please note that you have to save this file in Unicode
:: (UTF-16 / UCS-2 LE BOM) encoding.
::
:: For syntax highlighting the Notepad++ editor can be used.
:: The latest version of it can be downloaded for free from
:: http://www.notepad-plus-plus.org/
::
:: Below is a sample script. It defragments system files, including
:: registry, paging and hibernation files. Feel free to adjust it
:: to make it more suitable for your needs, replace it entirely
:: or keep as is.

:: turn the boot time defragmentation off for subsequent boots

boot-off

set UD_CLEAN_TEMP_FILES=1
set UD_TEMP_FILES_EXP_TIME=24h
set UD_DEFRAGMENTATION_DEPTH=80
set UD_OPTIMIZATION_DEPTH=80
set UD_IN_FILTER=*windows*;*winnt*;*ntuser*;*pagefile.sys;*hiberfil.sys
set UD_EX_FILTER=*temp*;*tmp*;*dllcache*;*ServicePackFiles*;*.log;*Windows.old*
set UD_EX_FILTER=%UD_EX_FILTER%;*\Windows\servicing\*

; exclude big fragments which rarely benefit from defragmentation

set UD_FRAGMENT_SIZE_THRESHOLD=20MB

:: on solid state drives exclude slightly fragmented content as well

set UD_SSD_FRAGMENTS_THRESHOLD=20

; uncomment the following line to increase amount of debugging output

; set UD_DBGPRINT_LEVEL=DETAILED

; uncomment the following line to save debugging information to a log file

; set UD_LOG_FILE_PATH=%UD_INSTALL_DIR%\logs\ud-boot-time.log

udefrag %SystemDrive%

exit

Optimalisatie van schijven

Als u uw schijven gaat optimaliseren met behulp van het aangepaste opstarttijdscript, overweeg dan om deUD_SSD_DEFRAGMENT_AND_TRIM_ONLY omgevingsvariabele in te stellen voorafgaand aan de schijfoptimalisatie, vooral als u Solid State Drives (SSD) in uw systeem hebt geïnstalleerd. Deze optie verkort de SSD-optimalisatietijd enorm zonder enig verlies aan optimalisatie-efficiëntie. Ook verlengt het de levensduur van SSD.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
@echo off
::
:: This script performs the full optimization
:: of all the available non-removable disks
:: except solid state drives (SSD) for which
:: it performs defragmentation and trimming only.
::
:: Please note, you have to save this script
:: in Unicode (UTF-16 / UCS-2 LE BOM) encoding.
::

:: turn the boot time defragmentation off for subsequent boots

boot-off

:: skip slightly fragmented files on SSD

set UD_SSD_FRAGMENTS_THRESHOLD=20

:: during SSD optimization defragment and trim the disk only

set UD_SSD_DEFRAGMENT_AND_TRIM_ONLY=1

udefrag -o --all-fixed

:: pass control back to the Windows boot process

exit

Uitsluiting van bestanden van defragmentatie

Tijdelijke bestanden, archieven en multimediabestanden hebben doorgaans geen invloed op de systeemprestaties en moeten daarom worden uitgesloten van defragmentatie om de verwerkingstijd van de schijf te verkorten.

U kunt ze eenvoudig allemaal uitsluiten met behulp van deUD_EX_FILTER omgevingsvariabele, op dezelfde manier als in de automatische defragmentatiescripts :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
@echo off
::
:: This script excludes temporary files, archives,
:: multimedia files and big fragments from defragmentation
:: and then defragments all the available non-removable disks.
::
:: Please note, you have to save this script
:: in Unicode (UTF-16 / UCS-2 LE BOM) encoding.
::

:: turn the boot time defragmentation off for subsequent boots

boot-off

:: exclude temporary files

set UD_EX_FILTER=*system volume information*;*temp*;*tmp*;*recycle*
set UD_EX_FILTER=%UD_EX_FILTER%;*dllcache*;*ServicePackFiles*;*.log
set UD_EX_FILTER=%UD_EX_FILTER%;*Windows.old*

:: exclude archives

set ARCHIVE_PATTERNS=*.7z;*.7z.*;*.arj;*.bkf;*.bz2;*.bzip2;*.cab;*.cpio;*.deb
set ARCHIVE_PATTERNS=%ARCHIVE_PATTERNS%;*.dmg;*.gz;*.gzip;*.lha;*.lzh;*.lzma
set ARCHIVE_PATTERNS=%ARCHIVE_PATTERNS%;*.rar;*.rpm;*.swm;*.tar;*.taz;*.tbz
set ARCHIVE_PATTERNS=%ARCHIVE_PATTERNS%;*.tbz2;*.tgz;*.tpz;*.txz;*.xar;*.xz
set ARCHIVE_PATTERNS=%ARCHIVE_PATTERNS%;*.z;*.zip
set UD_EX_FILTER=%UD_EX_FILTER%;%ARCHIVE_PATTERNS%

:: exclude multimedia files

set AUDIO_PATTERNS=*.aif;*.cda;*.flac;*.iff;*.kpl;*.m3u;*.m4a;*.mid
set AUDIO_PATTERNS=%AUDIO_PATTERNS%;*.mp3;*.mpa;*.ra;*.wav;*.wma
set VIDEO_PATTERNS=*.3g2;*.3gp;*.asf;*.asx;*.avi;*.flv;*.mov;*.mp4
set VIDEO_PATTERNS=%VIDEO_PATTERNS%;*.mpg;*.rm;*.srt;*.swf;*.vob;*.wmv
set UD_EX_FILTER=%UD_EX_FILTER%;%AUDIO_PATTERNS%;%VIDEO_PATTERNS%

:: exclude big fragments

set UD_FRAGMENT_SIZE_THRESHOLD=20MB

:: defragment all the available non-removable disks

udefrag --all-fixed

:: pass control back to the Windows boot process

exit

Uitsluiting van schijven van defragmentatie

Als u bepaalde schijven wilt uitsluiten van defragmentatie, kunt u dit eenvoudig doen met behulp van deUD_EX_FILTER omgevingsvariabele:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
@echo off
::
:: This script defragments all the available
:: non-removable disks except the disk H:
::
:: Please note, you have to save this script
:: in Unicode (UTF-16 / UCS-2 LE BOM) encoding.
::

:: turn the boot time defragmentation off for subsequent boots

boot-off

set UD_EX_FILTER=%UD_EX_FILTER%;H:\*

udefrag --all-fixed

:: pass control back to the Windows boot process

exit

U kunt ook eenvoudig schijven uitsluiten met een bepaald fragmentatieniveau:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
@echo off
::
:: This script performs the full optimization
:: of all the available non-removable disks
:: having fragmentation level above 20%.
::
:: Please note, you have to save this script
:: in Unicode (UTF-16 / UCS-2 LE BOM) encoding.
::

:: turn the boot time defragmentation off for subsequent boots

boot-off

set UD_FRAGMENTATION_THRESHOLD=20

udefrag -o --all-fixed

:: pass control back to the Windows boot process

exit

Automatische uitschakeling na voltooiing van de taak

U kunt de computer eenvoudig automatisch uitschakelen nadat de taak is voltooid. Dit is vooral handig als u een bewerking uitvoert die veel tijd kost, bijvoorbeeld schijfoptimalisatie:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
@echo off
::
:: This script optimizes the system disk
:: and then shuts the computer down.
::
:: Please note, you have to save this script
:: in Unicode (UTF-16 / UCS-2 LE BOM) encoding.
::

:: turn the boot time defragmentation off for subsequent boots

boot-off

:: optimize the system disk

udefrag -o %SystemDrive%

:: shut the computer down when the disk optimization finishes

shutdown
Deel deze pagina:
Scroll naar boven Engels