Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The program does not terminate
#1
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!


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."
Reply


Messages In This Thread
The program does not terminate - by krovit - 08-09-2024, 11:06 PM
RE: The program does not terminate - by krovit - 08-09-2024, 11:22 PM
RE: The program does not terminate - by krovit - 08-09-2024, 11:42 PM
RE: The program does not terminate - by SMcNeill - 08-10-2024, 08:41 AM
RE: The program does not terminate - by krovit - 08-10-2024, 09:28 AM
RE: The program does not terminate - by SMcNeill - 08-10-2024, 10:34 AM
RE: The program does not terminate - by krovit - 08-10-2024, 01:18 PM
RE: The program does not terminate - by krovit - 08-10-2024, 02:42 PM
RE: The program does not terminate - by Pete - 08-10-2024, 03:05 PM
RE: The program does not terminate - by krovit - 08-10-2024, 06:54 PM
RE: The program does not terminate - by SMcNeill - 08-10-2024, 11:21 PM



Users browsing this thread: 4 Guest(s)