Does everything work if you remove the "/B? switch from the DOS "exit" command?
/B Specifies to exit the current batch script instead of CMD.EXE. If executed from outside a batch script, it quits CMD.EXE.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Running a batch file through the Task Scheduler
Its running fine, completes everything expected
Then continues to run without end for no reason
Batch File contains:
-> "C:{PATH}\bin\runapp.cmd"
Runapp contains:
-> cd "C:{PATH}\"
-> java -cp {FILE NAME}.jar; {PACKAGE NAME}
-> exit /b
Maybe it is because my user is not an admin yet im trying to run with highest privileges:
If it was this, how could i get around this to allow the tas to run while user isnt signed in... i already tried using the admin account on the laptop!
The action appears as follows:
Java file it executes just creates a file, which its doing fine... But not ending the task, any suggestions?????
Does everything work if you remove the "/B? switch from the DOS "exit" command?
/B Specifies to exit the current batch script instead of CMD.EXE. If executed from outside a batch script, it quits CMD.EXE.
I don't see anything in there that has to do with PowerShell. Also, I'm not sure I understand what you mean to do with constructs like "cd "C:{PATH}\". Are you trying to access environment variables?
C:\Users\richm>cd "C:{PATH}\"
The system cannot find the path specified.
Batch File contains:
-> "C:{PATH}\bin\runapp.cmd"
So your scheduled task runs BatchFile.cmd which in turn calls runapp.cmd?
Add the /c switch to the arguments so that cmd.exe terminates when the batch file completes.
C:\>cmd /?
Starts a new instance of the Windows command interpreter
CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
[[/S] [/C | /K] string]
/C Carries out the command specified by string and then terminates
You should also capture stdout and stderr so that you can troubleshoot any execution messages.
Answer Found in the end:
-> my java was using a Java swing component called "JOptionPane.showMessageDialog"
-> this wasn't closing preventing the file from closing