Jump to content

#RequireAdmin and FileCopy - (Moved)


Recommended Posts

Hello!

 

I have a script that makes a directory, copies a file locally from a server, and executes it.  I know the file gets there and executes but then I get the UAC prompt.  When I put #RequireAdmin at the top of my script, the file doesn't even get to the directory.  I was hoping someone could help since I am new to this.  Does anyone know what is going on?         

Link to post
Share on other sites
  • Developers

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites
#RequireAdmin
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>

;Variables
Local Const $fpath="C:\bomgar"
Local Const $bomsource32="G:\Bomgar\Workstations\32-bit"
Local Const $bomsource64="G:\Bomgar\Workstations\64-bit\bomgar.exe"
Local Const $bomfile64="C:\bomgar\bomgar.exe"

;Create path and copy file to path
DirCreate($fpath)
FileCopy($bomsource64, $fpath, 1)
Run($bomfile64)

;UAC on .exe 

So here it is.  Like I mentioned, it copies over and must execute because I get the AUC prompt on the .exe when I don't have #RequireAdmin.  Thank you.

Link to post
Share on other sites
  • Developers

Try first using the UNC path, in stead of the mapped drive, to the sourcefile when running elevated.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...