Frimlik
Posts: 5
Joined: Thu Mar 28, 2019 1:39 am

Custom action folder command line parameter does not work

Hello,

I need to call schtasks command with own XML file (settings, that are available for Scheduled Tasks in Installer itself, aren't enough for me), so I created a batch file with this command and placed it into Temporary folder (I placed some "debug sleeps" into the batch).
Then I defined Custom Action - Launch File, where I call the batch file (i.e. [&myTempBatch.bat] in "File to launch" box). To be able to create scheduled task, this action must be done under admin privileges, so I checked the "Run as Administrator" box.
Moreover I needed to set folder param as command line argument (to be able to set the scheduled task executable path according to user's installation folder choice), so I chose Application Folder from the folder tree - "[APPDIR]" in "Command line" box.
The joke is that if I close this argument ("[APPDIR]") into quotes in order to have parameter with path "C:\Program Files (x86)\CompanyFolder\..." instead of "C:\Program" (which happens if I do not enclose the [APPDIR] with quotes), the installation process crashes - cmd black window just flashes - obviously no action happened at all.
I also tried unchecking the "Run as Administrator" checkbox and now cmd black windows shows, but it all ends with "Access denied".

What am I doing wrong way and is there any way to do this with Admin rights (change some path or whatever)?
Any help will be appreciated.

George
Catalin
Posts: 6600
Joined: Wed Jun 13, 2018 7:49 am

Re: Custom action folder command line parameter does not work

Hello George and welcome to Advanced Installer forums,

I am not sure why this happens.

In order for me to investigate this, could you please forward me, by e-mail at support at advancedinstaller dot com the following:
  • the .AIP file
  • a download link for the setup built using the earlier specified .AIP file
Also, what kind of scheduled task you are trying to create? Could you please give me some more details about this as well?

Looking forward to hearing from you.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Frimlik
Posts: 5
Joined: Thu Mar 28, 2019 1:39 am

Re: Custom action folder command line parameter does not work

I've investigated through google further and have found that in this case it is enough to check the "Run under the LocalSystem account with full privileges" option.

But I wonder, what the option "Run as Administrator" does and why it does not work (from my point of view) with batch files. Could you, please, explain it to me?

Thanks a lot.
George
Catalin
Posts: 6600
Joined: Wed Jun 13, 2018 7:49 am

Re: Custom action folder command line parameter does not work

Hello George,

Normally, there should not be any problems when trying to create the scheduled task from either under the LocalSystem account or from an user that is part of the Administrators group.

However, after further having a look into this, it seems that this is caused by an issue in what regards Advanced Installer. Trying to run a .bat file as administrator and giving it arguments enclosed between quotes will make the setup crash.

An easy workaround for this would be to use the "Run under the LocalSystem account" as you have already stated in your last thread.

Another workaround would be to simply uncheck the "Run as administrator" option from your custom action and have the "Run as administrator" option for your whole setup.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Frimlik
Posts: 5
Joined: Thu Mar 28, 2019 1:39 am

Re: Custom action folder command line parameter does not work

Hello Catalin,

thanks for your response.
For some reason I expected, that setup itself runs under admin privileges (to be able to write into Program Files folder), but obviously I was wrong :D.

George.
Catalin
Posts: 6600
Joined: Wed Jun 13, 2018 7:49 am

Re: Custom action folder command line parameter does not work

You are always welcome, George.

Glad I could help.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”