0

I currently have some code that installs all Dell updates silently but I would like the end-user be able to browse for the dell updater msi if it cannot locate it. I'm close but it appears to not like one of the quotes or something after you select the file via the browse option. Can anyone assist?

@echo off
SET file="S:\Software\Dell Command Update\DellCommandUpdate.msi"
if exist "C:\Program Files (x86)\Dell\CommandUpdate\dcu-cli.exe" goto:skipinst
if exist %file% goto:instdellupd

echo Please navigate to the DellCommandUpdate.msi file
set dialog="about:<input type=file id=FILE><script>FILE.click();new ActiveXObject
set dialog=%dialog%('Scripting.FileSystemObject').GetStandardStream(1).WriteLine(FILE.value);
set dialog=%dialog%close();resizeTo(0,0);</script>"
for /f "tokens=* delims=" %%p in ('mshta.exe %dialog%') do set "file=%%p"

:instdellupd
echo Installing Dell Command Update app
start %file% /quiet

:skipinst
echo Running the Dell Command Update app
"C:\Program Files (x86)\Dell\CommandUpdate\dcu-cli.exe" /ApplyUpdates
pause

2 Answers 2

0

{untried}

In your set commands, you need to "escape" each <,> by preceding it with a caret ^

but

Having done that, the quoted command in the for /f is itself parsed, so you actually then need to escape each <,>,^,) by preceding it with another caret ^

Which means that each < for example needs to be ^^^< to allow for two levels of parsing.

0

I managed to get it working. Here's my final code:

@echo off
cls
SET file=S:\Software\Dell Command Update\DellCommandUpdate.msi
if exist "C:\Program Files (x86)\Dell\CommandUpdate\dcu-cli.exe" goto:runDellUpdater
if exist "%file%" goto:installDellUpdater

echo Please navigate to the DellCommandUpdate.msi file
set dialog="about:<input type=file id=FILE><script>FILE.click();new ActiveXObject
set dialog=%dialog%('Scripting.FileSystemObject').GetStandardStream(1).WriteLine(FILE.value);
set dialog=%dialog%close();resizeTo(0,0);</script>"
for /f "tokens=* delims=" %%p in ('mshta.exe %dialog%') do set "file=%%p"

:installDellUpdater
echo Installing Dell Command Update app
"%file%" /quiet

:runDellUpdater
echo Running the Dell Command Update app
"C:\Program Files (x86)\Dell\CommandUpdate\dcu-cli.exe" /ApplyUpdates
pause

If anyone is interested, you can download Dell Command Update self-extracting exe directly from Dell, and after it extracts and before you hit close, browse to %temp% to find the msi, make a copy of it, then you can use my above code to help deploy and execute the Dell updater on any Dell machine. It will silently install all updates it finds.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.