jeremytammik / VisualStudioRevitAddinWizard

Visual Studio templates to generate C# and VB .NET Revit add-ins
http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.20
MIT License
205 stars 72 forks source link

Install script alteration suggestion #6

Closed irneb closed 7 years ago

irneb commented 7 years ago

In the install.bat file you're getting to the documents folder by building up the path using the username. Unfortunately this isn't always the case. Also the C drive is not necessarily where the user's home folder resides.

I suggest changing the 6th line from this:

set "D=C:\Users\%USERNAME%\Documents\Visual Studio 2015\Templates\ProjectTemplates" to this: set "D=%userprofile%\Documents\Visual Studio 2015\Templates\ProjectTemplates"

That should at least help where the user's home folder isn't in the usual position (or named the same as the username).

What is a bit cumbersome though is if the Documents folder under that has been relocated. Unfortunately the only place this is available is in registry. Else you can get to it using vbscript / powershell.

Here's a way of using powershell inside of a BAT file:

set T="%TEMP%\docspath.tmp" powershell -Command "[Environment]::GetFolderPath('MyDocuments') | Out-File '%T%' -Encoding ascii" set /p DOCSPATH=< "%T%" del "%T%"

Thereafter the line above can be changed to this instead:

set "D=%DOCSPATH%\Visual Studio 2015\Templates\ProjectTemplates"

Though it just feels way too complicated for my taste.

jeremytammik commented 7 years ago

i fully agree! thank you for your effective fix in pull request #7!