Remove Trailing Backslashes from (ItemDir) in External Tools

Nathan Sokalski 4,126 Reputation points

In my External Tools... I have a command with $(ItemDir) in the Arguments field. I want this to return the directory of the item without any trailing backslashes for filename, like the following:
However, it is including an extra backslash & double quote like the following:
How can I avoid the trailing \" ?

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,874 questions
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 114.5K Reputation points

    Maybe adding a '.' after $(ItemDir) will also work:


    This will probably generate "D:\AppForms\SP1_Forms\SP1_Forms\.", which is equivalent to "D:\AppForms\SP1_Forms\SP1_Forms".

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Dylan Zhu-MSFT 6,406 Reputation points

    Hi njsokalski,

    You can try to type this command: "$(ItemDir)".

    Best Regards, Dylan

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our * *documentation* to enable e-mail notifications if you want to receive the related email notification for this thread.**

    0 comments No comments