Solved short DOS program regarding VIM

October 12, 2018 at 21:00:09
Specs: Windows 10
So I'm starting to work with Vim, however, the vim "filename.txt" command to open a file in vim isn't working for me. I've tried vim, vi, vim.exe, vi.exe but none of these worked

The conclusion that I would need to write a short program and make my own bat program, to put in sys 32, that would take place of the seemingly broken vim keyword.

This is my first DOS program and hopefully my last until I learn it inits entirety, so I just need a quick solution to make this work; my current program is as follows...

"Path to the vim.exe file"

which opens vim, however, I want it to open the file following the keyword vim, can someone point me to an API or another resource? Or even just quickly teach me how to do it?

Thank you for your time.


See More: short DOS program regarding VIM

Reply ↓  Report •

✔ Best Answer
October 15, 2018 at 02:44:10
if you did install vim version 7.4 properly(but did not add it to the %PATH% variable), you should be able to start vim like this:

lets say you've opened cmd.exe & changed the current directory to "%USERPROFILE%\desktop"
with the command:
cd "%USERPROFILE%\desktop"

on the desktop there is a file called test.txt, inside the file you've writen:

succes


now in order to open "file.txt" with vim you'll need to make a file called vi.bat & place it in C:\windows\system32

vi.bat should contain:

@echo off
if "%1"=="" echo no filename was given&pause>nul&exit/b
"C:\Program Files (x86)\Vim\vim74\vim.exe" "%~1"

Openeing the file.txt on the desktop can be done by running this command from the desktop with this command:

vi "file.txt"

vim.exe should open file.txt located on the desktop & you should see the text "succes" in vim

i5-6600K[delid]@4.7GHz/4.3GHz@1.376v LLC=6 | 2x4GB Crucial-DDR4-2133CL15@14-14-14-28 1T 2700MHz@1.35v
MSI Armor RX 570 4GB@1260Mhz core@1.000v/2000MHz

message edited by hidde663



#1
October 13, 2018 at 00:08:09

Reply ↓  Report •

#2
October 13, 2018 at 00:29:47
It sounds like a simple matter of vim.exe not being in your PATH.

https://stackoverflow.com/questions...


Reply ↓  Report •

#3
October 15, 2018 at 01:25:28
I agree with ijack #2

Do you get a response from cmd.exe that looks like this?:

'vim' is not recognized as an internal or external command,
operable program or batch file.

(You do know vim.exe is not nativly installed in windows 10 right?)

option 2 (if you downloaded a version of vim.exe and placed in system32):

there are some compatability issues with vim and win 10, so you should probably download vim from the official website instead of some random hosting site.

"taken from https://stackoverflow.com/questions...

You can get the latest stable release on vim.org's download page.

However, the official release is usually a bit minimal and patches are released every couple of days so you might be interested in a more complete and up-to-date build. You can find one at the tuxproject site.

Also, avoid sites like softonic like the plague they are.

posted by "romainl"

default path to wim.exe shoud be:
C:\Program Files (x86)\Vim\vim74


i5-6600K[delid]@4.7GHz/4.3GHz@1.376v LLC=6 | 2x4GB Crucial-DDR4-2133CL15@14-14-14-28 1T 2700MHz@1.35v
MSI Armor RX 570 4GB@1260Mhz core@1.000v/2000MHz

message edited by hidde663


Reply ↓  Report •

Related Solutions

#4
October 15, 2018 at 02:44:10
✔ Best Answer
if you did install vim version 7.4 properly(but did not add it to the %PATH% variable), you should be able to start vim like this:

lets say you've opened cmd.exe & changed the current directory to "%USERPROFILE%\desktop"
with the command:
cd "%USERPROFILE%\desktop"

on the desktop there is a file called test.txt, inside the file you've writen:

succes


now in order to open "file.txt" with vim you'll need to make a file called vi.bat & place it in C:\windows\system32

vi.bat should contain:

@echo off
if "%1"=="" echo no filename was given&pause>nul&exit/b
"C:\Program Files (x86)\Vim\vim74\vim.exe" "%~1"

Openeing the file.txt on the desktop can be done by running this command from the desktop with this command:

vi "file.txt"

vim.exe should open file.txt located on the desktop & you should see the text "succes" in vim

i5-6600K[delid]@4.7GHz/4.3GHz@1.376v LLC=6 | 2x4GB Crucial-DDR4-2133CL15@14-14-14-28 1T 2700MHz@1.35v
MSI Armor RX 570 4GB@1260Mhz core@1.000v/2000MHz

message edited by hidde663


Reply ↓  Report •

Ask Question