Tuesday 24 October 2017

windows 7 - How to open the stdout with Notepad++?


On OSX TextMate have the alias mate which you can use with the pipe to open other program's stdout.


How can I achieve the same effect in Windows 7 with Notepad++?


Ex.: git diff master|edit



Answer



No, Windows does not have equivalent functionality to /dev/stdin or /dev/fd on Unixes. (It would be stdin, not stdout, from Notepad++'s point of view.) While GUI programs can read from stdin, they must be specially written to do so.




@echo off & setlocal
set f=%temp%\stdin-%random%%random%%random%.txt
more > "%f%"
start /wait notepad++ "%f%"
del "%f%"

If you don't want the batch file to "/wait" for notepadd++ to exit, you can replace the above "start /wait" line with these two lines:




start notepad++ "%f%"
REM Windows timeout won't work inside batch files. Use ping hack instead.
ping 127.0.0.1 -n 3 -w 10000 > nul

No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...