jeudi 21 mars 2019

How do I write a batch script that will look in two file paths for the executable and then run it

I have written a batch file that looks in two folder paths for an executable and then runs it. I am new to writing batch file and have been told this is sloppy and can be better written with an if / else statements.

@echo off Taskkill /im firefox.exe >nul 2>nul echo Remove and re-install Mozilla Firefox "C:\program files\Mozilla Firefox\uninstall\helper.exe" /s "C:\program files (x86)\Mozilla Firefox\uninstall\helper.exe" /s

So far nothing I have found appears to work; Here is the last attempt that is not working;

@echo off Taskkill /im firefox.exe >nul 2>nul echo Remove and re-install Mozilla Firefox

IF exist helper.exe /s ( "C:\program files\Mozilla Firefox\uninstall\ ) else helper.exe /s ( "C:\program files (x86)\Mozilla firefox\uninstall\ )

Aucun commentaire:

Enregistrer un commentaire