- NSIS Discussion
- Passing UNC path to setup with /D switch
Archive: Passing UNC path to setup with /D switch
Jasmin Sehic
9th August 2006 03:41 UTC
Passing UNC path to setup with /D switch
Hi guys,
Any idea why it is not possible to set the installation path to an UNC path during the execution of the setup?
For example:
setup.exe /D=\\mycomputer\install
Doing this does nothing because it is detecting it as an invalid path for some reason.
Any response will be much appreciated.
Cheers,
Jasmin
Jasmin Sehic
9th August 2006 03:53 UTC
----- EDIT -----
READ POST BELLOW
----- EDIT -----
Jasmin Sehic
9th August 2006 04:20 UTC
Ok, its me again. :)
I found that UNC paths are OK but UNC paths without a folder are not ok.
For example:
You can install into \\mycomputer\share\folder
But you cannot install into \\mycomputer\share directly because it seems to not allow the installation path to be the root of a drive or a share.
I can understand the root of the drive being disallowed as the installation path but the root of the share should be ok?
What are your thoughts?
Regards,
Jasmin
niteflyer
9th August 2006 11:16 UTC
Just an idea: did you allow "AllowRootDirInstall" (NSIS-instruction, see Help 4.8.1.2). The default is false, so if dont use this instruction, you wont be allowed to install in the root.
Afrow UK
9th August 2006 12:01 UTC
It should allow root install for that path if it doesn't point to the root of a hard drive, but I don't know if NSIS can be coded to detect that quickly.
-Stu
niteflyer
9th August 2006 12:17 UTC
According to the documentation, network shares are also prohibited by "AllowRootDirInstall False", but I did not test that. I am not an API-expert, but I _guess_ that NSIS cannot detect that a share represents the root of a drive.
Jasmin Sehic
10th August 2006 02:06 UTC
Thanks for the replies guys.
I tried using the AllowRootDirInstall true and that seems to allow installation to the root of a drive with the use of the /D switch
For example this works now:
setup.exe /D=C:\
But unfortunatelly this still doesn't work for me:
setup.exe /D=\\mycomputer\share
Even when the AllowRootDirInstall is set to true.
So this bit of text from the help section seems to be incorrect since a share cannot be selected at all:
AllowRootDirInstall controls whether or not installs are enabled to the root directory of a drive, or directly into a network share. Set to 'true' to change the safe behavior, which prevents users from selecting C:\ or \\Server\Share as an install (and later on, uninstall) directory.
I've even tried using .onVerifyInstDir but it doesn't seem to help as the /D switch UNC paths deemed invalid are ignored.
I really didn't want to resort to modifying the exehead to do what I need but I guess I will have to if I cannot find a solution.
Regards,
Jasmin
Jasmin Sehic
10th August 2006 02:12 UTC
Oops. I found what I was doing wrong. Seems you need an additional backslash at the end of the UNC path for it to be deemed valid. So now this works:
setup.exe /D=\\mycomputer\share\
Whereas before this didn't work:
setup.exe /D=\\mycomputer\share
Thanks for eveyone's help! :up:
niteflyer
10th August 2006 11:03 UTC
Just to know: does this work with or without "AllowRootDirInstall TRUE" and does your share map to the root of a logical partition (driveletter) ? Can you test these scenarios ?
/D should also preset the default directory presented by the DirPage in nonsilent mode (without /S). Watch if the Nextbutton is enabled with this default. Even without /D you should be able to select the root of your share with "AllowRootDirInstall TRUE".
Jasmin Sehic
11th August 2006 03:29 UTC
Yes this only works when AllowRootDirInstall is set to TRUE and yes it works on any share regardless of what is being shared (i.e. root of a logical drive) as long as you end the UNC path with a backslash.
I've also found a way to install to a root of a share without using AllowRootDirInstall TRUE.
All you have to do is this:
setup.exe /D=\\mycomputer\share\..\share\
The backreference seems to trick the installer into thinking its a folder in the root of the share so it allows it.