[wpkg-users] [OT] Batch and find...
Marco Gaiarin
gaio at sv.lnf.it
Wed Jun 10 14:54:05 CEST 2020
Non trictly related to WPKG but...
I've setup a netlogon script, that check default browser, and reset it
to firefox if is set to a not supported browser (FF and Chrome).
In win7:
set _setbrowser=1
reg query "HKCU\Software\Clients\StartMenuInternet" /f "Firefox-308046B0AF4A39CB" /d /e >nul 2>nul
if ERRORLEVEL 0 (
set _setbrowser=0
)
reg query "HKCU\Software\Clients\StartMenuInternet" /f "Google Chrome" /d /e >nul 2>nul
if ERRORLEVEL 0 (
set _setbrowser=0
)
if %_setbrowser% EQU 1 (
if exist "%ProgramFiles%\Mozilla Firefox\uninstall\helper.exe" (
"%ProgramFiles%\Mozilla Firefox\uninstall\helper.exe" /SetAsDefaultAppUser
)
)
and works. But in Win10 i have to use some helpers
(GetUserFTA/SetDefaultBrowser) and the code:
set _setbrowser=1
if exist "%ProgramFiles%\GetUserFTA.exe" (
"%ProgramFiles%\GetUserFTA.exe" | find "http, FirefoxURL-308046B0AF4A39CB" >nul 2>nul
if ERRORLEVEL 0 (
set _setbrowser=0
)
"%ProgramFiles%\GetUserFTA.exe" | find "http, ChromeHTML" >nul 2>nul
if ERRORLEVEL 0 (
set _setbrowser=0
)
)
if %_setbrowser% EQU 1 (
if exist "%ProgramFiles%\SetDefaultBrowser.exe" (
"%ProgramFiles%\SetDefaultBrowser.exe" HKLM Firefox-308046B0AF4A39CB
)
)
because '%_setbrowser% is always '0'. I've tried to run in terminal:
"%ProgramFiles%\GetUserFTA.exe" | find "http, FirefoxURL-308046B0AF4A39CB"
and work as expected, eg:
P:\>"c:\Program Files\GetUserFTA.exe" | find "http, "
http, IE.HTTP
P:\>"C:\Program Files\GetUserFTA.exe" | find "http, FirefoxURL-308046B0AF4A39CB"
P:\>echo %ERRORLEVEL%
1
and
P:\>"c:\Program Files\GetUserFTA.exe" | find "http, "
http, FirefoxURL-308046B0AF4A39CB
P:\>"C:\Program Files\GetUserFTA.exe" | find "http, FirefoxURL-308046B0AF4A39CB"
http, FirefoxURL-308046B0AF4A39CB
P:\>echo %ERRORLEVEL%
0
What i'm missing? Thanks.
--
dott. Marco Gaiarin GNUPG Key ID: 240A3D66
Associazione ``La Nostra Famiglia'' http://www.lanostrafamiglia.it/
Polo FVG - Via della Bontà, 7 - 33078 - San Vito al Tagliamento (PN)
marco.gaiarin(at)lanostrafamiglia.it t +39-0434-842711 f +39-0434-842797
Dona il 5 PER MILLE a LA NOSTRA FAMIGLIA!
http://www.lanostrafamiglia.it/index.php/it/sostienici/5x1000
(cf 00307430132, categoria ONLUS oppure RICERCA SANITARIA)
More information about the wpkg-users
mailing list