On Thu, 2006-09-14 at 13:01 +0300, Nikolaos A. Patsopoulos wrote:
>
> 1. I want to edit multiple files from command line so I created a
> vim script with all the commands (>20). I use a batch file in WinXP:
>
>   |@echo off
>   vim -s script file.txt
>   exit
>
> however I need to run this script on multiple files. In vim's help
> there is this code for use in bash(?) shell
>
>   ||for file in *.txt; do|
>   |     vim -e -s $file < change.vim|
>   |     lpr -r tempfile|
>   |done
>
> however it doesn't seem to work under Cygwin.

To do an operation on multiple files in a WinXP DOS batch:

  for %%A in (*.txt) do [command]

Chain multiple commands after the "do" statement with " & ":

  for %%A in (*.txt) do vim -e -s change.vim "%%A" & copy "%%A" lpt1

or call a separate batch that takes %1 as the argument:

  for %%A in (*.txt) do call MyEdit.bat "%%A"

where MyEdit.bat is:

  @echo OFF
  echo File %1...
  vim -e -s change.vim "%1"
  copy "%1" lpt1

Note that I usually sprinkle double quotes liberally to avoid issues
with spaces in paths.


-- 
Steve Hall  [ digitect dancingpaper com ]


Reply via email to