This bat-file runs an sql file without opening microsoft sql management studio. If I run the file a dos-window is beeing opened and displays an sql report (how many lines have been affected and so on).
Now I would like to run this bat-file out of a java program. I used: Runtime.getRuntime().exec("C:\\SQLTask.bat");
Unfortunately no DOS Window is beeing displayed (and I need the report of the sql server).
How do I have to change my code in order to run the bat-file out of my java tool and to open a dos window, which displays the report ?
I tried with Start "C:\Programme.... -> but I dont know how to set the quotes. it does not work
The thing is, the command window is triggered by the OS when you run the batch file directly. When you execute it through Java, it won't trigger the command window.
Fortunately, you can call it yourself. Change your command to "CMD.exe /C C:\\SQLTask.bat" - this won't call the batch script but calls a command window in which the script will be run. Check out "cmd /?" for more info.