DOS Command Line - Directory Listing and open in notepad in one line
Here are common examples on Stack OverFlow to opening a directory listing into notepad, but they don't work.
dir > notepad dir | notepad
Here's a fully working way to open directory listing into Notepad. You have to create a file.
dir > dir.txt && notepad dir.txt
Or create file in temp directory (C:\Users\{Username}\AppData\Local\Temp)
dir > %temp%\dir.txt && notepad %temp%\dir.txt
dir | uniclip && uniclip /notepad
Hacking
Here's a way to create a file and delete it, but it locks the cmd shell, until notepad executable is closed. In other words, you cannot issue command in the cmd shell, because handle is being used by Notepad. Once closed the > (command prompt) will return. Then deletes file %1. Does not appear in Recycle bin, but can be recovered by unerase programs.
dir > %1 | notepad %1 && del %1
dir > %1 | notepad %1 && del %1 && exit
BTW Microsoft, in partnership with IBM and in the spirit of open innovation, released the source code to MS-DOS 4.00 under the MIT license.
No comments:
Post a Comment