Jump to content

CMD: Pass more commands to a single shell !

Recommended Posts

Hi guys, if i do this:

WIN+R -> cmd /k echo Hello -> ENTER

WIN+R -> cmd /k echo World -> ENTER

I'll have 2 different CMD shell windows: the first displays "Hello", while the second "World".

Do you know if is it possible to launch the second command in the same CMD shell window of the first one, to have:


Thank you in advance

Edited by Caml Light
Link to post
Share on other sites

Yes, that works launching a single instance of cmd.exe. But does exists a way to do exactly what i wrote?

I am failing to see the difference between what you initially asked and the result of what was suggested, can you try expanding on what you want to achieve? :unsure:

Additionally, I presume that your actual GOAL is NOT that of having one or more CMD.EXE windows echoing to screen "Hello World" :w00t: , please do state the actual GOAL, there might be different ways to achieve that.

Be aware of the risk of slipping on a chocolate covered banana :ph34r: :



Link to post
Share on other sites

ok... i'll try to explain better:

Imagine to have a CMD shell window already opened. Is it possible to pass it some commands, not writing them into that shell but from WIN+R?

Win+R simply opens the "Run" dialog/popup.

In it you have to type some commands.

You can use some tool (like Nircmd):


to set focus to the already active CMD window and paste/execute in it some command.

This still seems completely unlike being a GOAL (or if it is a goal, it appears like a senseless one :ph34r: ).

BTW, you seem like having a tradition of being reluctant in providing the actual scope of what you are asking for, posting instead "vague" or "generic" examples, which everytime need some back and forth rounds of questions to actually get what the actual question is about. (and hopefully provide an appropriate solution/answer/advice)


Link to post
Share on other sites

Thank you jaclaz, the actual scope of my question is written in the previous posts. My GOAL is exactly it: To pass to an opened cmd shell some commands written from the "Run" prompt.

Alternatively, instead to use the "Run" prompt, i also can use a cmd batch script that send commands to the opened cmd shell. If i run a common batch, it will open a new cmd shell window.

Link to post
Share on other sites

"Why?" or "To what end?" "What purpose..." does reusing a CMD window serve? Why not just include the command in a batch file?

If you want to run a batch script within a batch script, you can always CALL it without opening a new CMD window.

Edited by 5eraph
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...