Remove Trailing Backslashes from (ItemDir) in External Tools

Nathan Sokalski 4,116 Reputation points
2021-02-19T03:36:41.17+00:00

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:
D:\AppForms\SP1_Forms\SP1_Forms
However, it is including an extra backslash & double quote like the following:
D:\AppForms\SP1_Forms\SP1_Forms\"
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,605 questions
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 112.1K Reputation points
    2021-02-19T07:26:05.433+00:00

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

    $(ItemDir).

    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
    2021-02-19T06:55:20.277+00:00

    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