[text-editor] Edit a text file on the console using Powershell

In linux i'm a fun of Nano or vim, i used to use nano and now vim, and they are really good choices. There is a version for windows. Here is the link https://nano-editor.org/dist/win32-support/

However more often we need to open the file in question, from the command line as quick as possible, to not loose time. We can use notepad.exe, we can use notepad++, and yea, we can use sublim text. I think there is no greater then a lightweight, Too powerful editor. Sublime text here. for the thing, we just don't want to get out of the command line, or we want to use the command line to be fast. and yea. We can use sublime text for that. it contain a command line that let you quickly open a file in sublime text. Also there is different options arguments you can make use of. Here how you do it.

First you need to know that there is subl.exe. a command line interface for sublim.

enter image description here

1-> first we create a batch file. the content is

enter image description here

@ECHO OFF

"C:\Program Files\Sublime Text 3\subl.exe" %*

We can save that wherever we want. I preferred to create a directory on sublime text installation directory. And saved there the batch file we come to write and create.

(Remark: change the path above fallowing your installation).

2-> we add that folder to the path system environment variable. and that's it.

enter image description here

or from system config (windows 7/8/10)

enter image description here

then:

enter image description here

then:

enter image description here

then we copy the path:

enter image description here

then we add that to the path variable:

enter image description here

too quick!

launch a new cmd and now you've got subl command working well!

enter image description here

to open a file you need just to use subl command as fellow:

subl myfileToOpen.txt

you can also use one of the options arguments (type --help to see them as in the image above).

Also note that you can apply the same method with mostly any editor of your choice.