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

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.


Solution 1:

:!mycommand %:p

Related:

:!cd %:p:h

Solution 2:

The other two answers didn’t work for me (for some reason). However, I found that this combo displays the full path when typed in Normal mode:

Press 1 then CtrlG

Source: “Get the name of the current file” on the Vim Tips Wiki. See also the {count}CTRL-G section of :help CTRL-G.