我想在批处理文件中包括命令,自动设置 .html、.https 和照片的默认应用程序。我知道如何通过运行以下命令来更改文件关联:
ftype htmlfile="C:\Program Files\Google\Chrome\Application\chrome.exe" %1
但现在我需要将 Chrome 设置为 .https 和 .http 的默认文件。我很难让它工作,我尝试编辑注册表但没有成功,最后只能求助于一个混乱但有效的代码,如下所示:
control /name Microsoft.DefaultPrograms /page pageDefaultProgram
SET TempVBSFile=%tmp%\~tmpSendKeysTemp.vbs
IF EXIST "%TempVBSFile%" DEL /F /Q "%TempVBSFile%"
ECHO Set WshShell = WScript.CreateObject("WScript.Shell") >>"%TempVBSFile%"
ECHO Wscript.Sleep 2000 >>"%TempVBSFile%"
ECHO WshShell.SendKeys "{TAB 3}" >>"%TempVBSFile%"
ECHO Wscript.Sleep 1000 >>"%TempVBSFile%"
ECHO WshShell.SendKeys "{ENTER}" >>"%TempVBSFile%"
ECHO Wscript.Sleep 4000 >>"%TempVBSFile%"
ECHO WshShell.SendKeys "{TAB 3}" >>"%TempVBSFile%"
ECHO Wscript.Sleep 1000 >>"%TempVBSFile%"
ECHO WshShell.SendKeys "{ENTER}" >>"%TempVBSFile%"
ECHO Wscript.Sleep 4000 >>"%TempVBSFile%"
ECHO WshShell.SendKeys "{TAB 2}" >>"%TempVBSFile%"
ECHO Wscript.Sleep 1000 >>"%TempVBSFile%"
ECHO WshShell.SendKeys "{ENTER}" >>"%TempVBSFile%"
ECHO Wscript.Sleep 4000 >>"%TempVBSFile%"
ECHO WshShell.SendKeys "{TAB 1}" >>"%TempVBSFile%"
ECHO Wscript.Sleep 1000 >>"%TempVBSFile%"
ECHO WshShell.SendKeys "{ENTER}" >>"%TempVBSFile%"
::THERE IS MORE TRUST ME BUT I DONT WANT THIS TO FILL UP THE ENTIRE POST::
CSCRIPT //nologo "%TempVBSFile%"
echo Return here once you are done.
echo.
echo ^< Press ANY key to return to the Menu ^> & Pause > NUL)
CLS & Goto :Menu
任何帮助都很棒,这个社区到目前为止都很棒,喜欢阅读帖子并获得对我之前问题的回复。提前感谢所有发表评论的人。