0

I have a batch file which modifies some files within program files upon installation of an application using NSIS.

The issue I currently have is that NSIS is not running the batch file with administrator permissions so the script fails.

Is it possible to run the script with the required admin permission set?

It must support the OS XP+, and the batch script is run from an NSIS installer.

Matt Seymour
  • 8,880
  • 7
  • 60
  • 101
  • What OS and how do you start the batch (manually, scheduled task, etc)? Which lines of command(s) fail and what the error is? –  Jun 25 '13 at 14:43
  • @Mark please see revised question – Matt Seymour Jun 25 '13 at 14:50
  • Oh I see! With any rights an app runs, all apps it starts up will inherit the same so you'll have to start nsis app with admin rights. For that, here's the solution: http://stackoverflow.com/questions/8732019/how-do-you-request-administrator-permissions-using-nsis –  Jun 25 '13 at 14:54

2 Answers2

3

Is the NSIS installer being ran with administrator permissions? If so, any process that the installer starts will also have administrator permissions.

Check out Ander's answer on how to request admin rights for your installer:

https://stackoverflow.com/a/8735349/1030416

Community
  • 1
  • 1
Daniel N
  • 419
  • 8
  • 20
  • Thanks Daniel, yes the installer needs to be run as admin and it does request the right privillages (UAC), but the script does not appear to be running as admin. Which of the many exec commands would you use? – Matt Seymour Jun 26 '13 at 08:55
  • I would use Exec, if you need to wait until the process is done then use ExecWait. Does the batch file work when running outside of the NSIS installer while running as admin? – Daniel N Jun 28 '13 at 23:25
0

How do you execute your batch? Exec, ExecShell or nsExec?

Try changing it or paste snippet of your code here.

Slappy
  • 5,250
  • 1
  • 23
  • 29