I cant figure out the parameter(s) to change the default install path C:\Program Files\
of Notepad++ to the drive I want it to install to when I run my PowerShell script. I am trying to do a silent install and can't change it manually.
Does anyone know what parameters I can add to install the program to the E:
drive?
Below is my code and what I am trying in PowerShell. I have been messing around a lot with the -ArgumentList
parameters to figure out if I can point it to the E:
drive but no luck so far. I am running this on Windows Server 2012 also.
function install-Notepadpp()
{
$install="*PATH*\npp.6.6.2.Installer.exe"
Start-Process -FilePath $install -ArgumentList '/InstallDirectoryPath:"E:\"','/S' -Wait -Verb RunAs
Write-Host "Notepad++ has been installed." -ForegroundColor Green
}
##### This is Windows calling the function to install the script
install-Notepadpp
Best Answer
Do you really require an installation? You have the standalone package out there on dev site, you can copy it wherever you want. As for the 'cool' context menu addons, they are simple enough to add manually.
Below is the brief description of steps you need to take to get this done:
Have your Powershell copy the content of standalone package to the desired folder.
Generate a new GUID using Powershell
[guid]::NewGUID()
Write down the GUID to variable (so you can reference it later).
Under HKEY_CLASSES_ROOT\CLSID\ add GUID entry in the same way the rest of GUIDs are added.
Create a subcontainers InprocServer32 and Settings
In the InprocServer32 set the (Default) value to desired Notepad++ installation path pointing directly to NppShell_06.dll (ex. C:\Program Files\Notepad++\NppShell_06.dll)
Add ThreadingModel REG_SZ entry and set its' value to Apartment
In the Settings subcontainer, set the values accordingly - for a list of valid values, please reference a machine with Notepad++ installed. The most "interesting" ones are "Path" and "Title"
Add the GUID entry you generated earlier to subcontainer "ANotepad++" in HKEY_CLASSES_ROOT*\shellex\ContextMenuHandlers\ under (Default) value
This should do it. Although I did not test the above on my machine, I am pretty confident that this will sort out the "manual" installation issue. As a sidenote, it could be worth as a suggestion to developer (or, as a best way, write it on your own!) to add some silent installation configuration switches so that we don't have to bother with the above 'workarounds'. Should you run into some issues setting this up, let me know.