Start Batch file as Administrator (1 Viewer)

BlueIshDan

☠
Local time
Today, 18:46
Joined
May 15, 2014
Messages
1,122
I'm running into the issue where some of my batch files don't run correctly when the Access Application runs them.

Batch File:
Code:
FOR %%F IN ("*.prp") DO IF %%~zF EQU 0 DEL "%%F"
FOR %%F IN ("*.drv") DO IF %%~zF EQU 0 DEL "%%F"

start "" "%~dp0\Start.bat"
I believe that this is because the For loops above are deleting files and don't have permissions to do it when ran from the application.

Does anyone know how I can modify this VBA to launch as Administrator?

VBA Snippet:
Code:
Shell parent_path & "\Copy_" & Get2000Or2100 & ".bat"


Thanks! ;)
 

BlueIshDan

☠
Local time
Today, 18:46
Joined
May 15, 2014
Messages
1,122
I'm thinking I might have to call to a .dll and declare a new function into the project. =/
I don't exactly know which drivers do what yet, maybe this can help someone help me! lol
 

BlueIshDan

☠
Local time
Today, 18:46
Joined
May 15, 2014
Messages
1,122
Nobody able to help me with this? =/
 

DavidAtWork

Registered User.
Local time
Today, 22:46
Joined
Oct 25, 2011
Messages
699
I guess people aren't familiar with running .bat files from Access. The .bat files I have ever run has always been from the Windows task scheduler, I've never tried to run one from Access

David
 

BlueIshDan

☠
Local time
Today, 18:46
Joined
May 15, 2014
Messages
1,122
Blah I guess so! Lol
I would normally run them from the task scheduler, but they are used as file management procedures because their speed cannot be beat lol.
 

spikepl

Eledittingent Beliped
Local time
Today, 23:46
Joined
Nov 3, 2010
Messages
6,142
Not sure about this permission-stuff, but did you consider VBS? There you'd have access to the file scripting object etc..
 

BlueIshDan

☠
Local time
Today, 18:46
Joined
May 15, 2014
Messages
1,122
Using vbs would be the same as using the File System Object in VBA (I think). BLAH
 

spikepl

Eledittingent Beliped
Local time
Today, 23:46
Joined
Nov 3, 2010
Messages
6,142
Not really. Because VBS can be run as a script, similar to a BAT whereas VBA cannot as such
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 07:46
Joined
Jan 20, 2009
Messages
12,852
AutoIT has a RunAs method.

You can script the entire job in it or use it to run the bat file.
 

BlueIshDan

☠
Local time
Today, 18:46
Joined
May 15, 2014
Messages
1,122
Thank you Galaxiom, I'll have to take a look at this!
Seems like a cool tool. :)
 

Users who are viewing this thread

Top Bottom