Ik wil tijdvertraging toevoegen aan mijn batchbestand. Het batchbestand wordt stil uitgevoerd op backgorund. Help me alsjeblieft.
Antwoord 1, autoriteit 100%
timeout 5
om te vertragen
timeout 5 >nul
om uit te stellen zonder u te vragen op een toets te drukken om te annuleren
Antwoord 2, autoriteit 15%
U wilt time-out gebruiken.
time-out 10
slaapt 10 seconden
Antwoord 3, autoriteit 15%
ping localhost -n (your time) >nul
voorbeeld
@echo off
title Test
echo hi
ping localhost -n 3 >nul && :: will wait 3 seconds before going next command (it will not display)
echo bye! && :: still wont be any spaces (just below the hi command)
ping localhost -n 2 >nul && :: will wait 2 seconds before going to next command (it will not display)
@exit
Antwoord 4
Ok, ja, je gebruikt de opdracht timeout
om te slapen. Maar om het hele proces stil te doen, is het niet mogelijk met cmd/batch. Een van de manieren is om een VBScriptte maken dat het Batchbestandzal uitvoeren zonder een venster te openen/tonen.
En hier is het script:
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "PATH OF BATCH FILE WITH QUOTATION MARKS" & Chr(34), 0
Set WshShell = Nothing
Kopieer en plak de bovenstaande code in Kladblok en sla het op als
Elke naam.**vbs
**
Een voorbeeld van het *”PATH OF BATCH FILE WITH QUOTATION MARKS” * kan zijn:
“C:\ExampleFolder\MyBatchFile.bat”