简体   繁体   中英

executing a second command in a batch file

i have batch file that clears a value in the registry that is related to the usage block of chrome on a PC. every time i double click the batch file it will clear that value allowing an admin to use chrome. i have a user that needs to access an EPA website but can only on chrome. below is the code i tried to use but the second command after editing the registry does not run. it will never open a chrome webpage. i want their IE to stay default. i will set chrome's homepage to the page she needs for simplicity. how can i achieve the results i want?

REGEDIT4

; @ECHO OFF
; CLS
; REGEDIT.EXE /S "%~f0"
; EXIT

[HKEY_CURRENT_USER\Software\Policies\Google\Chrome\URLBlacklist]
"1"=- 
&
@echo off
start chrome.exe https://cdx.epa.gov/epa_home.asp

this is what i am trying to execute.

echo
reg delete HKEY_CURRENT_USER\Software\Policies\Google\Chrome\URLBlacklist /v 1 /f
echo done.

echo
start chrome.exe https://cdx.epa.gov/epa_home.asp
echo done.
reg delete HKEY_CURRENT_USER\Software\Policies\Google\Chrome\URLBlacklist /v 1 /f
"C:\Program Files\SomeFolder\chrome.exe" https://cdx.epa.gov/epa_home.asp

Your code is crazy.

I don't use non programmable browsers. You'll have to fix the path. This works using WINDOWS.

"C:\Program Files\Internet Explorer\iexplore.exe" https://cdx.epa.gov/epa_home.asp

remove.reg

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Policies\Google\Chrome\URLBlacklist]
"1"=-

remove.bat

echo Removing 1st entry in URL blacklist...
regedit /S remove.reg
echo done.
echo Opening blocked site...
start chrome.exe https://cdx.epa.gov/epa_home.asp
echo done.

Whilst bizarre, it can be done in the style of the original

REGEDIT4

; @ECHO OFF
; CLS
; REGEDIT.EXE /S "%~f0"

[HKEY_CURRENT_USER\Software\Policies\Google\Chrome\URLBlacklist]
"1"=- 

; start chrome.exe https://cdx.epa.gov/epa_home.asp
; EXIT 

; indicates a comment in registry files but appears to be ignored when at the start of a batch file line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM