Hello, I need your help!
Not sure if I didn't sleep well or what, but my script here doesn't do anything and I cannot see the error!
I need to do a restart function in my application. So I create a .bat script that delays for 5 seconds before launching the application.
What I end up with is this:
So it looks like it's only opening cmd, but not executing the bat file?
Thanks for your help!
Not sure if I didn't sleep well or what, but my script here doesn't do anything and I cannot see the error!
I need to do a restart function in my application. So I create a .bat script that delays for 5 seconds before launching the application.
B4X:
Dim Script As String = $"@echo off
echo Restarting Notepad
echo Waiting for 5 seconds...
timeout /t 5 /nobreak > NUL
echo Starting the application...
start "C:\WINDOWS\system32\notepad.exe"
exit
"$
Dim BatchFile As String = File.Combine("C:\", "NotepadRestarter.bat")
File.WriteString(File.GetFileParent(BatchFile), File.GetName(BatchFile), Script)
If File.Exists(File.GetFileParent(BatchFile), File.GetName(BatchFile)) Then
Dim sh As Shell
sh.Initialize("Restart", BatchFile, Null)
sh.Run(1000)
Else
LogError("Restart failed")
End If
What I end up with is this:
So it looks like it's only opening cmd, but not executing the bat file?
Thanks for your help!