Re: External command with arguments (WinXP): cmd /c problem

2007-02-15 Thread Fan Decheng

A.J.Mechelynck wrote:

[EMAIL PROTECTED] wrote:
Hm, this is strange, the windows shell cmd (not vim!) has problems 
with the

following:

cmd.exe /c "C:\Programme\Microsoft Office\Office10\OUTLOOK.EXE" /a

"c:\Dokumente und Einstellungen\hofjoa41\Eigene Dateien\test.txt"

-> "C:\Programme\Microsoft not found"

If I use the command above directly at the shell *without* the cmd /c 
part it

works properly!

I think I will ask also at alt.msdos.batch.nt if cmd /c has a special
problem.



Joachim ###

This message has been scanned by F-Secure Anti-Virus for Microsoft 
Exchange.

For more information, connect to http://www.f-secure.com/





If you replace "Microsoft Office" by its 8.3 equivalent (MICROS~1 or 
similar) you can leave out the quotes around it and it will still work 
OK, because there won't be spaces then, to be mistaken for separators.


Best regards,
Tony.


I've also encountered this problem many times since I often call cmd 
with /c in my scripts or programs. The answer to this problem may be 
strange, but at least I found one thing: if the path of the executable 
contains no space, don't quote it. However, if the path does contain a 
space, and the problem still arises, I don't know what to do.




Tip: selecting a file to edit with the handy completion feature

2006-08-18 Thread Fan Decheng
Only recently did I read the vim manual for command line completion. In
the documentation, I found that the following is a handy way to open a
file when using the :e command.

1. Type :e followed with a space.
2. Type the first a few characters of the file you want to edit.
3. Press CTRL-L. Vim will do completion like most UNIX shells do.
4. Type more characters if the file name is not expected.
5. Repeat step 3 to 4 until the file name is complete.
Note: After pressing CTRL-L, if you still cannot remember the rest part
of the file name, press CTRL-D to list all possible names. This works
like the Bourne Again Shell.

Happy Vimming!






***SPAM*** Re: gvim not using the shell option for ! commands

2006-06-03 Thread Fan Decheng

Juan Lanus wrote:

Gerald Lai  eecs.oregonstate.edu> writes:
  

One more thing you can try. Run Sysinternal's Filemon at
   http://www.sysinternals.com/Utilities/Filemon.html



The filemon program shows that:

this program   does this   to this path   & this happens
vimrun.exe:816 QUERY INFO >C:\WINNT\system32\cmd.exe \e:8192.com< PATH NOT FOUND
vimrun.exe:816 QUERY INFO >C:\WINNT\system32\cmd.exe \e:8192.exe< PATH NOT FOUND
vimrun.exe:816 QUERY INFO >C:\WINNT\system32\cmd.exe \e:8192.bat< PATH NOT FOUND
vimrun.exe:816 QUERY INFO >C:\WINNT\system32\cmd.exe \e:8192.cmd< PATH NOT FOUND

I imagine that vimrun triggered a system() command for to run
"%SystemRoot%\system32\cmd.exe /e:8192" and that Windows is looking for a
plausible extension for to add to the ending 8192. 


The string "C:\WINNT\system32\cmd.exe \e:8192" is my COMSPEC variable, with a /E
option for to have more space for Environment variables.

vimrun is treating the whole COMSPEC content as a path, while it can be a path
with flags: SET ComSpec=%SystemRoot%\system32\cmd.exe /e:8192

After this gvim looks for cmd.exe in several locations. None of them in the good
one, that's set in _gvimrc:
set shell=%SystemRoot%\system32\cmd.exe
A :set shell returns this one, with %SystemRoot% replaced. 


The manual (os_dos.txt) says:
The default for the 'sh' ('shell') option is ... "cmd.exe" on Windows NT.  If
SHELL is defined, Vim uses SHELL instead, and if SHELL is not defined but
COMSPEC is, Vim uses COMSPEC.  Vim starts external commands with " /c
".  


If I delete the /E:8192 option from the COMSPEC system variable then vimrun
works OK. But all my COBOL software will fail ...

IMO this is a bug, specially how gvim is failing to select the shell option
before anything else. Now I'll be able to sleep.

Thanks Gerald.
--
Juan Lanus
TECNOSOL
Argentina


Test case, for Windows NT:
gvim fails to use the shell option in ! commands
1- Add a flag to the COMSPEC system variable, for example /E:8192
2- Add a set shell= in _gvimrc
3- Open a file in gvim 
4- !!path fails with a tempfile error

5- :!path fails with a -1 status code in a DOS window


  
I have an idea: use a gvim.bat file to start gvim.exe. In the gvim.bat 
file, make sure there are these lines:


@echo off
setlocal
...
set COMSPEC=C:\WINDOWS\system32\cmd.exe
...
rem the line to start gvim.exe
...
end local

In addition, try not to use vimrun to run your COBOL programs. Use a 
command prompt instead.