For example, the current directory is D:\, then I want to run dir
on C:\.
Via this post I know &&
is useful to connect 2 commands: runtime.exec("cmd.exe /k c: && dir")
. But how to make the process to wait some seconds before the 2nd command being executed,i.e. after switch to C:\ and before dir
operation. In my real scenario I need to check the feedback of the 1st command.
And how to keep the cmd window unclosed after execution?