Reputation: 59
I am creating a batch file for some of my colleagues with a ton of stuff to run when deploying a new virtual machine.
However, one thing I cannot figure out is how to find a file and change to that directory in a Windows Command Prompt.
I am looking to have the batch file use an installed programs setup.exe
file to uninstall itself, but depending on the version installed, depends on where the setup.exe
file resides.
So essentially, looking for something like this:
find setup.exe
cd /d c:\path\to\file\setup.exe --uninstall --system-level
Upvotes: 0
Views: 57
Reputation: 1
Maybe you can use the following
where /r "C:\" SETUP.EXE | findstr "SETUP"
pushd %~dpnx2
I don't know much about batch scripting, and since ERRORLEVEL returns an integer (and is not modified by WHERE) I can't seem to think how to access the "returned" directory by WHERE
Upvotes: -1