I have a simple script and I want to call it from my Java code. The script does not run properly.
The script is very simple: mkdir 0000000;
public static void main(String[] args) throws Exception{
String path = "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe";
String command = "C:\\test\\test.ps1";
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec(path + " " + command);
proc.destroy();
}
The dir "0000000" is not created. I use JDK 7, windows 10.
Any suggestion would be gratefully appreciated.
I changed the code as below and finally it worked!