5

When I connect to a 64-Bit Windows server via PowerShell e.g., is there some built-in command-line tool that allows text editing (assuming that I cannot/do not want to install software)?

For Linux, e.g., I can expect that there is vi installed on virtually every system. For old DOS/Windows version, there has been edit.exe which seems not to be there anymore.

jaw
  • 932
  • 2
  • 10
  • 24
  • http://stackoverflow.com/questions/19497399/basic-text-editor-in-command-prompt – Stefan Sprenger Jul 20 '15 at 11:59
  • FYI `edit` (16 bit) only ships w/ 32bit versions of Windows – Alex K. Jul 20 '15 at 12:00
  • @AlexK. Thanks, I just added the requirement to my question. – jaw Jul 20 '15 at 12:23
  • @StefanSprenger Based on that question (and their answers), it seems that there is no such thing as a built-in edit, right? – jaw Jul 20 '15 at 12:24
  • @jaw I think there is nothing on 64 bit :-/ – Stefan Sprenger Jul 20 '15 at 13:07
  • possible duplicate of [Edit a text file on the console in 64-bit Windows](http://stackoverflow.com/questions/11045077/edit-a-text-file-on-the-console-in-64-bit-windows) – Scott Chamberlain Jul 20 '15 at 14:20
  • 1
    @ScottChamberlain Why has this question been put on hold? I was not asking for they best tool, I specifically asked whether there is a built-in tool at all that I don't know of. Should i further describe the "problem"? I just want to edit a text file on the shell. – jaw Jul 20 '15 at 20:42
  • It was put on hold because 5 people voted it to be closed. Yu Hao and user2062950 both voted that they thought you where asking for was off topic (recommend or find a book, tool, software library, tutorial or other off-site resource), I voted that it was a duplicate of the question I posted in my comment, we can't tell what Hong Ooi and Lightness Races in Orbit voted for. – Scott Chamberlain Jul 20 '15 at 21:03
  • 1
    @ScottChamberlain: Unfortunately, the "duplicate" question did not ask for a built-in tool or at least all answers are based on 3rd-party tools. – jaw Jul 22 '15 at 12:54
  • @yu-hao: Same question to you: Why has this question been put on hold? I was not asking for they best tool, I specifically asked whether there is a built-in tool. There are are only two answers possible: 1.) There is not editor or 2.) There is an editor called "xyz.exe". So could you please reopen the question? – jaw Jul 22 '15 at 12:59
  • `cat`, `type`, `more` will display file contents. Can also be stored in variables eg. in `for` loop for editing. Then redirect edited variables back to file. `type` & `echo` can also output text to file.
    `findstr`, `find`, substring & substitution of strings can speed up the process. This question is closed, there's nowhere to post an answer, else I'd post an example. Tested on Powershell & CMD on Win 10 x64
    – Zimba Nov 05 '19 at 15:07

1 Answers1

1

(not enough reputation to comment, so will do it here)

As far as I know, there's not a built-in editor; however, a workaround would be to use:

type CON>myfile.txt

As explained here, this will forward the input in the console to your file. Not nice, not powerfull, but it may help sometimes.

Please note this WON'T work through Powershell, but you may use it with winrs -r:server cmd or with psexec.

Community
  • 1
  • 1
curropar
  • 334
  • 2
  • 17