批处理文件动态查找 chrome 安装路径
Batch file to find chrome installed path dynamically
我需要通过 运行 .bat 文件检查任何 Windows 系统中的 chrome 浏览器。批处理文件应该能够检查系统中是否安装了 Chrome 浏览器。如果它的安装想要将路径存储在变量中并使用 that.I 正在创建 chrome kiosk app..所以需要找到 chrome 路径 dynamically.Please 帮助我
start "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --kiosk --fullscreen --incognito "website url"
经过我们在聊天中的讨论,我们发现如果 chrome
没有安装,它就不会启动。因此只需使用:
start "" "chrome" --kiosk --fullscreen --incognito "https://www.netflix.com/"
我们需要确保所有其他 chrome windows 都已关闭,因为如果 chrome 已经打开,它将不会打开信息亭模式。
这意味着如果默认情况下使用 start
找不到 chrome
,则不会安装。
较早的尝试:
此 batch
文件假设 chrome 安装正确:
for /F "delims=" %%a in ('where chrome') do (
start "" "%%a" --kiosk --fullscreen --incognito "website url"
)
pause
一旦您确认它正在运行,只需从最后一行中删除 echo
即可实际执行启动。
下一个选项,因为 where
可能行不通,那就是搜索文件。
pushd C:
cd\
for /F "delims=" %%a IN ('dir /b /a-d /s chrome.exe') do (
start "" "%%a" --kiosk --fullscreen --incognito "https://www.netflix.com/in/"
)
pause
简单的解决方案是:
start "" chrome.exe --kiosk --fullscreen --incognito "website url"
必须使用 ""
或命令指定空标题 START 将第一个双引号字符串解释为可选标题字符串。 运行 在命令提示符 window start /?
中获取有关此命令及其选项的帮助。
启动成功的原因Chrome没有完整路径,也没有包含在环境变量PATH
中的文件夹路径在[=]的回答中有解释16=]
chrome.exe
(通常)根据 Microsoft Application Registration 的指南正确注册。所以 START 能够找到 Chrome 应用程序本身的路径。
首先检查 Chrome 是否安装和注册的解决方案:
@echo off
%SystemRoot%\System32\reg.exe query "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe" >nul 2>&1
if not errorlevel 1 start "" chrome.exe --kiosk --fullscreen --incognito "website url"
我需要通过 运行 .bat 文件检查任何 Windows 系统中的 chrome 浏览器。批处理文件应该能够检查系统中是否安装了 Chrome 浏览器。如果它的安装想要将路径存储在变量中并使用 that.I 正在创建 chrome kiosk app..所以需要找到 chrome 路径 dynamically.Please 帮助我
start "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --kiosk --fullscreen --incognito "website url"
经过我们在聊天中的讨论,我们发现如果 chrome
没有安装,它就不会启动。因此只需使用:
start "" "chrome" --kiosk --fullscreen --incognito "https://www.netflix.com/"
我们需要确保所有其他 chrome windows 都已关闭,因为如果 chrome 已经打开,它将不会打开信息亭模式。
这意味着如果默认情况下使用 start
找不到 chrome
,则不会安装。
较早的尝试:
此 batch
文件假设 chrome 安装正确:
for /F "delims=" %%a in ('where chrome') do (
start "" "%%a" --kiosk --fullscreen --incognito "website url"
)
pause
一旦您确认它正在运行,只需从最后一行中删除 echo
即可实际执行启动。
下一个选项,因为 where
可能行不通,那就是搜索文件。
pushd C:
cd\
for /F "delims=" %%a IN ('dir /b /a-d /s chrome.exe') do (
start "" "%%a" --kiosk --fullscreen --incognito "https://www.netflix.com/in/"
)
pause
简单的解决方案是:
start "" chrome.exe --kiosk --fullscreen --incognito "website url"
必须使用 ""
或命令指定空标题 START 将第一个双引号字符串解释为可选标题字符串。 运行 在命令提示符 window start /?
中获取有关此命令及其选项的帮助。
启动成功的原因Chrome没有完整路径,也没有包含在环境变量PATH
中的文件夹路径在[=]的回答中有解释16=]
chrome.exe
(通常)根据 Microsoft Application Registration 的指南正确注册。所以 START 能够找到 Chrome 应用程序本身的路径。
首先检查 Chrome 是否安装和注册的解决方案:
@echo off
%SystemRoot%\System32\reg.exe query "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe" >nul 2>&1
if not errorlevel 1 start "" chrome.exe --kiosk --fullscreen --incognito "website url"