Batch file that installs software

June 11, 2019 at 11:59:19
Specs: Windows 10
This has been driving me absolutely nuts! I've created a batch file that installs .net, one piece of software and two drivers. They are all in the form of executables.

When I am logged in as the local administrator, it works beautifully, no questions asked.

When I am logged in as JDOE, the XCOPY portion of the batch file works fine, but I am prompted 4 consecutive times to provided elevated login credentials. How do I get it to prompt me only once for elevated rights? Running this on Windows 10.

Here's what I got:


@echo off
::
::
MD C:\TEMP\SOFTWARE
::
::
XCOPY ".\SOFTWARE\*.*" C:\TEMP\SOFTWARE /I /Y /E /S
XCOPY ".\MICKEYMOUSE\*.*" C:\TEMP\SOFTWARE\FIRMWARE /I /Y /E /S
::
::
"C:\TEMP\SOFTWARE\NDP46-KB3045557-x86-x64-AllOS-ENU.EXE" /passive /log c:\temp\SOFTWARE\dotnet.txt
::
::
"C:\TEMP\SOFTWARE\SOFTWARE.EXE" /passive /log C:\TEMP\SOFTWARE\log.txt
::
::
C:\TEMP\SOFTWARE\DRIVER1.exe
::
::
C:\TEMP\SOFTWARE\DRIVER2.exe /q /Logfile C:\TEMP\SOFTWARE\Log.txt
::
::
:end


See More: Batch file that installs software

Report •

#1
June 11, 2019 at 13:01:01
create a shortcut to the batch file, in the sortcut options, select always run as admin.

i5-6600K[delid]@4.9GHz/4.4GHz cache@1.504v | 2x4GB Crucial-DDR4-2400CL17@CL12-15-15-28 1T 3000MHz@1.45v | Sapphire Nitro+ SE RX 590 8GB@1450Mhz core@0.925v/2250MHz@1500MHz timings BiosModded


Report •

#2
June 14, 2019 at 12:25:05
No luck : ( I still get

File not found - *.*
0 File(s) copied
File not found - *.*
0 File(s) copied
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
File not found - *.*
0 File(s) copied


Report •

#3
June 16, 2019 at 00:51:42
Have you tried full pathname instead of "."? It looks to me like "." is not reaching the intended path, since it's not finding any files. If the full-path needs to be variable, then that needs to be addressed in your batch. Not tested, just a thought.

Report •

Related Solutions

#4
June 17, 2019 at 04:20:57
I still think the objective of this thread is to know why it is asking for elevated rights ... and the answer is given in reply #1, possibly. If not, please clarify.

If the error message as mentioned only in reply #2 is giving you headaches, try this advice: do not use relative paths (or "CD" commands) in scripts. You are obviously in the wrong drive or path, when the script is called. But if you really want to I can't prevent you, but please add some error handling (which is a general advice in scripting).

If you copy a file, why not check if the source file is present ? Check out the IF statement in CMD.

message edited by Looge


Report •

Ask Question