Lately I’ve encountered problems with the usage of predefined variables available for External Tools in Visual Studio 2015. The problem was that I needed to pass the file currently opened in the VS Editor to external process.

The good part it that documentation for this tool (External) is available here. The bad part is that description exposed for available variables is quite parsimonious.

For a file there are actually three options:

1. $(ItemPath) – The complete file name of the current file (drive + path + file name). 2.$(ItemFilename) – The file name of the current file (file name).
3. $(ItemExt) – The file name extension of the current file. So far, so good. The wicked thing is that$(ItemPath) is with extension, i.e. fully qualified name, while $(ItemFilename) is without. But$(ItemExt) contains a dot as first character!

So the values for the above three variables would be:

1. d:\full\path\to\the\file\name.ext
2. name (I’m not aware of why not name. for example)
3. .ext (… why not ext [without dot] for example)

## Conclusion

For absolute path – use item 1. For relative path use item 2 and 3 concatenated as shown in the picture below – i.e. $(ItemFilename)$(ItemExt) not $(ItemFilename).$(ItemExt)

It is my mistake that I do not read documentation properly, but anyway I’d like to warn other lost souls that might bump in this.

## PS

The most wicked of of all is that in VS2015 Arguments field length is 251 chars!