MSFN Forum: CMD: Pass more commands to a single shell ! - MSFN Forum

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CMD: Pass more commands to a single shell ! Rate Topic: -----

#1 User is offline   Caml Light 

  • Junior
  • Pip
  • Group: Members
  • Posts: 85
  • Joined: 03-October 03

Posted 01 November 2012 - 08:30 PM

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:

Hello
World
_


Thank you in advance

This post has been edited by Caml Light: 01 November 2012 - 08:31 PM



#2 User is offline   5eraph 

  • Update Packrat
  • Group: Supreme Sponsor
  • Posts: 954
  • Joined: 04-July 05
  • OS:XP Pro x64
  • Country: Country Flag

Posted 01 November 2012 - 10:46 PM

You could use the ampersand (&) to pass more than one command per line.

cmd /k echo Hello &echo World


#3 User is offline   Caml Light 

  • Junior
  • Pip
  • Group: Members
  • Posts: 85
  • Joined: 03-October 03

Posted 01 November 2012 - 11:19 PM

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

#4 User is offline   5eraph 

  • Update Packrat
  • Group: Supreme Sponsor
  • Posts: 954
  • Joined: 04-July 05
  • OS:XP Pro x64
  • Country: Country Flag

Posted 02 November 2012 - 09:34 AM

If there is, I don't know it.

#5 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,456
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 02 November 2012 - 09:43 AM

View PostCaml Light, on 01 November 2012 - 11:19 PM, said:

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: :
http://homepage.ntlw...red-banana.html

jaclaz

#6 User is offline   Caml Light 

  • Junior
  • Pip
  • Group: Members
  • Posts: 85
  • Joined: 03-October 03

Posted 02 November 2012 - 12:31 PM

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?

#7 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,456
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 02 November 2012 - 01:17 PM

View PostCaml Light, on 02 November 2012 - 12:31 PM, said:

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):
http://www.nirsoft.n...ils/nircmd.html
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)

jaclaz

#8 User is offline   Caml Light 

  • Junior
  • Pip
  • Group: Members
  • Posts: 85
  • Joined: 03-October 03

Posted 02 November 2012 - 03:15 PM

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.

#9 User is offline   5eraph 

  • Update Packrat
  • Group: Supreme Sponsor
  • Posts: 954
  • Joined: 04-July 05
  • OS:XP Pro x64
  • Country: Country Flag

Posted 02 November 2012 - 04:32 PM

"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.

This post has been edited by 5eraph: 02 November 2012 - 04:37 PM


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy