Windows – In Windows avoid nano triggering overwrite mode on cmd line

command linenanowindows

In Windows 8 I have installed nano, because it's my preferred command line text editor.

When I use it, it works normally, just as it would on any Linux distribution:

C:\>nano file.c 

However, when I return to the cmd prompt overwrite mode is always enabled as if I had pressed the insert key. This is highly annoying because I'm frequently going back and forth between nano and the cmd prompt.

Is there a way to fix this?

Best Answer

  • @echo off
    nano %1
    echo WScript.CreateObject("WScript.Shell").SendKeys "{INSERT}" > Ins.vbs
    cscript //B Ins.vbs
    del Ins.vbs
    

    Save the above as a batch file and call with the file name you want to edit.

  • Related Question