I have a simple servlet program running on apache-tomcat-9.0.38(Windows 10). The program tries to launch command prompt using following code (Not the exact code,)
java.lang.Runtime.getRuntime().exec("cmd.exe /c start cmd.exe /k \"dir && ping \"localhost\" && EXIT\"");
When servlet tries to execute the above line, it does not launch command prompt. However, if I execute the same piece of code in simple java program on same machines, it launches command prompt successfully.
I have verified that the system user and applications have execute access on cmd.exe and also verified that the tomcat service user is system user.
I am not sure why it fails to launch command prompt only when servlet program tries to execute above mentioned line. (Note: Same servlet program works well on other Windows 10 machine )
Quick help will be really appreciated.
Thank you.