How can I expand the full path of the current file to pass to a command in Vim?

Viewed 56436

When I go to command mode and type

:!mycommand %

I get my command executed on the current file (% is expanded to the current file name). Is there a similar construct that expands the full file name (with the full path)?

I am using Windows.

6 Answers

Append :p, e.g.

:!mycommand %:p

And %:p:h will give you the path of the directory that the file resides in.

Related