Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

CMD – How do I run a command twice in one line?

How do I display both the host name and boot time?
The code I’m trying:

systeminfo | find /i "host name" && "boot time"

I know I could use

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

systeminfo | find /i "host name"

systeminfo | find /i "boot time"

but I really don’t want to.

Basically I want the command to display the host name and boot time and ignore all else. How do I do that on one line? I know I’m missing something super simple here.

>Solution :

I have faced a similar problem before, and I may be able to help you out. If I understand your question correctly, you’re looking for a way to display both the host name and boot time on one line, using a single prompt. In that case, the following command should do the trick, ignore the curly brackets of course:

{systeminfo | find /i "host name" & systeminfo | find /i "boot time"}

Using the ‘&’ character will execute the two ‘systeminfo’ commands sequentially and output the results on the same line.

I wish you the best of luck with your project. Let me know if I can help with anything else.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading