http://www.perlmonks.org?node_id=1207878


in reply to Re: Write file in Windows Programs folder
in thread Write file in Windows Programs folder

Before you panic about UAC, you may want to verify that this isn't a simple case of trying to run from a non-admin account. Right-click on the command prompt icon, RunAs Administrator, and launch your Perl script from there. If it works as an admin user, you can probably code a test for that and tell the user what to do if it fails. (I do most of my Perl in Linux, so I'm probably not the best person to help you with that part).

If open my $fh, '>', $path or die "Can't open $path: $!\n"; still fails on your programs dir when run as an admin, then you can panic.

Replies are listed 'Best First'.
Re^3: Write file in Windows Programs folder
by Anonymous Monk on Jan 25, 2018 at 18:39 UTC

    No solution worked. I can not write/copy in the Programs folder. I packed the script in an exe in order to run it as Administrator (do not know how to run a script as Administrator), but nothing is written in the Programs folder.

    However, there are some programs installed in the same folder doing automatic updates, which I guess means automatic replace some files in the installation folder. I am a bit scared of looking into the "writing rights" matter. Just seems to complicated for me.