The current vimtutor.bat has several problems. It basically does not work on modern Windows with the default installation path.
When launching the vim tutor from the start menu, one can see that
the tutor appears. The problem is that it is not the copy as intended,
but just the tutor file under "C:\Program Files (x86)\Vim\vim82\tutor".
After digging around a bit, I have found:
Problem 1: vimtutor.bat cannot really determine whether a directory is writable or not.
FOR%%d in (. "%TMP%""%TEMP%") DO IFEXIST%%d\nulSETTUTORCOPY=%%d\$tutor$
This line does not work. I am not sure whether it used to work or
not, but it does not now. "C:\Program Files (x86)\Vim\vim82" is not
writable in modern Windows, but the script cannot detect the case.
After struggling with the batch file for a while (oh, bash looks such
a beauty, when compared with the quirkiness of Windows batch), I
changed that line to the following:
FOR%%d in (. %TMP%%TEMP%) DO (
call :test_dir %0%%d
echo No working directory is found
COPY %1%TUTORCOPY%>nul2>nulgoto end
At this step, vimtutor.bat can run successfully from "C:\Program
Files (x86)\Vim\vim82", i.e. the shortcut. However, I still cannot run
the vimtutor.bat script at the command prompt in my home directory,
Problem 2: vimtutor.bat does not encode the path of gvim, and the wait behaviour of gvim.bat is different than gvim.exe.
This can be changed by changing gvim to "%~dp0gvim.exe".
:ntactionstart"dummy" /b /w "%~dp0gvim.exe" -u NONE -c "so $VIMRUNTIME/tutor/tutor.vim"IFERRORLEVEL1GOTO use_vim
:: Start gvim without any .vimrc, set 'nocompatible'start"dummy" /b /w "%~dp0gvim.exe" -u NONE -c "set nocp"%TUTORCOPY%
BTW, the -console path requires vim.bat and running from a path other than
"C:\Program Files (x86)\Vim\vim82" (if run without the ".bat" suffix). This should not be a problem in
daily usage (the quirky behaviour of batch makes solving the problem
harder than I expected).
I believe this basically solves the problem, although maybe breaking
compatibility with pre-NT Windows. Since the Vim executables already
requires Windows 5.1, we can probably eliminate the non-NT paths in
the batch file.