I need this when config Listary's custom command to load Rconsole within Explorer, with environment variable R_USER set to current directory for this very command.

What I currently use is effectively same as

cmd /C "set R_USER=%path%&& C:\path\to\Rgui.exe"

(which I learn from here to set environment variable.)

It works fine, except open an extra window for cmd itself. which adds hassle to switch application with Alt-Tab.

How can I achieve same workflow but without open the window for cmd itself?

P.S. (Listary handle the substitution part and run the specified command).


2 Answers 2


You need to put start command before your executable file path.


In order for the CMD window to automatically close, you can launch a program like so:

start /min "" "path_to_your_program"

The start command tells Windows to execute another CMD window outside the scope of the current CMD. The /min starts the CMD window minimized, and isn't necessary. The first set of double-quotes is definitely necessary, though anything can be placed within those quotes. The second set must contain the absolute path to your program inside.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.