我正在编写一个批处理文件,以全屏模式在Google Chrome中打开Netflix。我对批处理文件的了解还很幼稚,尽管...
chrome.exe --start-fullscreen --app=https://www.netflix.com
当从与chrome可执行文件相同的目录中运行时,这当然可以工作,但在其他任何地方都无法工作。
我正在寻找一种编写批处理文件的方法,以搜索并找到chrome.exe,然后使用上述开关执行该文件。这样,我可以将批处理文件共享给其他人,并且无论他们的文件路径如何,它都可以工作。能做到吗
- 编辑 -
由于Appleoddity建议不要进行搜索,因此这是否是为此目的编写批处理文件的最佳方法?
@echo off
cd\program files (x86)\google\chrome\application
chrome.exe --start-fullscreen --app=https://www.netflix.com
我写了一些有用的东西。没有阿德莱德爵士的职位,我无法做到。阿德莱德爵士,谢谢您的榜样。还要感谢其他贡献者。这是有教育意义的:)
(我之所以选择批处理而不是powershell,是因为我想与之共享powershell脚本的任何人都必须首先更改其执行策略设置。而批处理则不需要这样做。)
if exist "%localappdata%\google\chrome\application\chrome.exe" set file_found="yes"
if not exist "%localappdata%\google\chrome\application\chrome.exe" set file_found="no"
if %file_found%=="yes" set chrome_exe="%localappdata%\google\chrome\application\chrome.exe"
if exist "%programfiles%\google\chrome\application\chrome.exe" set file_found="yes"
if not exist "%programfiles%\google\chrome\application\chrome.exe" set file_found="no"
if %file_found%=="yes" set chrome_exe="%programfiles%\google\chrome\application\chrome.exe"
if exist "%programfiles(x86)%\google\chrome\application\chrome.exe" set file_found="yes"
if not exist "%programfiles(x86)%\google\chrome\application\chrome.exe" set file_found="no"
if %file_found%=="yes" set chrome_exe="%programfiles(x86)%\google\chrome\application\chrome.exe"
%chrome_exe% --start-fullscreen --app=https://www.netflix.com
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句