Skip to content

Command-line switch for cmd.exe that solves the process management issue #4

@GoogleCodeExporter

Description

@GoogleCodeExporter
Hi! Sorry to beat on this issue. I did some further research and
experimentation. It turns out that a better overall command line would be:

Runtime.getRuntime().exec("cmd /c start cmd", null, new File(path));

With this command line you can remove the whole "Process.destroy()" bit
that you added for Issue 3 (sorry!!).

Two fixes here are:
1. Use the "/c" switch instead of the "/k" switch so that the parent cmd
shell (the one that executes "start") terminates immediately.

2. Pass the path as the cwd instead of on the command line (optional, but
simplifies the command line--you can use your discretion here). If you do
not want to use the 3-arg form of exec, then you still need to use the "/k"
switch before the cd...i.e.: 
   "cmd /c start cmd /k \"cd /d" + path + "\""

Thanks much!
Dave

Original issue reported on code.google.com by dcit...@gmail.com on 27 Aug 2008 at 4:33

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions