Hello everyone!
This code performs some operations on network interfaces and the system date.
Considering that the executable has administrator privileges, I note that the executable does not terminate and the execution remains suspended.
The code includes delays to allow the execution of commands, especially on network interfaces, which notoriously take time.
I also note that the execution goes all the way through (the network is reactivated and the system date is restored correctly) but the output on the screen (which is also misaligned with the window) stops at the executed ping.
Is this a bug or what? Any suggestions?
Thank you!
This code performs some operations on network interfaces and the system date.
Considering that the executable has administrator privileges, I note that the executable does not terminate and the execution remains suspended.
The code includes delays to allow the execution of commands, especially on network interfaces, which notoriously take time.
I also note that the execution goes all the way through (the network is reactivated and the system date is restored correctly) but the output on the screen (which is also misaligned with the window) stops at the executed ping.
Is this a bug or what? Any suggestions?
Thank you!
Code: (Select All)
SHELL ("powershell -Command " + CHR$(34) + "Get-NetAdapter | Enable-NetAdapter -Confirm:$false" + CHR$(34))
ex$ = MID$(DATE$, 7, 4) + "-" + MID$(DATE$, 4, 2) + "-" + LEFT$(DATE$, 2) + "T" + TIME$
' Disabilita le schede di rete
SHELL "cmd /c powershell -Command " + CHR$(34) + "Get-NetAdapter | Disable-NetAdapter -Confirm:$false" + CHR$(34)
PRINT "step 1 fatto"
SLEEP 5 ' Attendi un momento per assicurarti che le schede siano disabilitate
' Controlla se la rete è disattivata
PRINT "Controllo stato della rete..."
SHELL "cmd /c ping -n 4 8.8.8.8" ' Pinga un server per verificare la disattivazione della rete
PRINT "Ping eseguito."
' Imposta la data e l'ora
SHELL "cmd /c powershell -Command " + CHR$(34) + "Set-Date -Date 2023-10-01T14:30:00" + CHR$(34)
PRINT "step 2 fatto"
SLEEP 2 ' Aggiungi un ritardo
' Imposta la data e l'ora attuale
SHELL "cmd /c powershell -Command " + CHR$(34) + "Set-Date -Date " + ex$ + CHR$(34)
PRINT "step 3 fatto"
SLEEP 2 ' Aggiungi un ritardo di 2 secondi
' Riabilita le schede di rete
SHELL "cmd /c powershell -Command " + CHR$(34) + "Get-NetAdapter | Enable-NetAdapter -Confirm:$false" + CHR$(34)
PRINT "step 4 fatto"
SLEEP 2 ' Aggiungi un ritardo finale
PRINT "Comandi eseguiti."