1731057280-windows_-_display_command_output_in_notepad.png

Windows - display command output in Notepad


Author:
Dwayne
Published in:
Tech
Published date:
Nov 8, 2024 09:14am
Post ID:
32
Tags:
infotip

The featured image is the Windows Run dialogue.

You can fish this up by pressing the windows key and r at the same time. Or find it in your start menu, labelled "Run...".

Obviously on "cool" windows and not "user-friendly ui" windows 8 or 10 ... as I don't use them. If your doing dev. stuff, well maybe stick to windows with a proper ui)



These are my notes on how to run a command in the windows run dialogue (windows key + r) and send (pipe) the results to notepad.

This is handy for those wanting to "ipconfig" and not have to open cmd first.

The thing to remember here is the run dialogue is not the same as command line.

So a simple > or | doesn't work straight off the bat. 

You can only use those in cmd.

If you open cmd and then call your command from there, you can pipe, write or get data.

You can call "cmd" on the windows run dialogue.


echo test message > text.txt | notepad text.txt

this doesn't work with the Windows Run dialogue but it does work on CLI

... so ...

cmd /k ipconfig

this opens cmd and does ipconfig


cmd /c ipconfig

this opens cmd , does ipconfig and then the console window closes immediately


... so ...


cmd /c echo test message > text.txt | notepad text.txt

opens cmd , does an "echo test message" that is sent to text.txt , which is piped to notepad , after closing notepad the console will close


a step further - lets remove the text.txt file after you close notepad :)

cmd /c echo test message > text.txt | notepad text.txt & del text.txt



so here's a quick ipconfig to notepad :

cmd /c ipconfig > x | notepad x & del x


or send ipconfig to cmd and do a pause , 

console closes after any key is pressed ( aaaaanny key ( as long as its 0-9 a-z ( :-) ) ) )

cmd /c ipconfig & pause


What's my local IP?

cmd /c ipconfig | grep IPv4 > x | notepad x & del x


Please register or sign-in to comment

© Copyright 2024 , OMI Ltd. and S.Dwayne Pivac. All rights reserved.