O que estou fazendo errado?
if exist "%PROGRAMFILES%\Mozilla Firefox\firefox.exe" start "%PROGRAMFILES%\Mozilla Firefox\firefox.exe" "https://www.example.com/"
Você não tem "title" no seu comando start .
-
Se não houver
"title", entãostartparses"%PROGRAMFILES%\Mozilla Firefox\firefox.exe"como título (porque começa com") e"https://www.example.com/"como o comando a ser executado. -
Executar o comando
"https://www.example.com/"faz com que o navegador padrão abra essa URL.
Tente adicionar "" após start :
if exist "%PROGRAMFILES%\Mozilla Firefox\firefox.exe" start "" "%PROGRAMFILES%\Mozilla Firefox\firefox.exe" "https://www.example.com/"
Syntax
START "title" [/D path] [options] "command" [parameters] Key:
titleText for the CMD window title bar (required.)pathStarting directory.commandThe command, batch file or executable program to run.parametersThe parameters passed to the command.
...
Always include a
titlethis can be a simple string like"My Script"or just a pair of empty quotes""According to the Microsoft documentation, the title is optional, but depending on the other options chosen you can have problems if it is omitted.
Origem comece
Leitura Adicional
- Um índice A-Z da linha de comando do Windows CMD - Uma excelente referência para todas as coisas relacionadas à linha do Windows cmd.
- iniciar - Iniciar um programa, comando ou script em lote (abre em uma nova janela).