Question

I want to make a Batch File (.bat) to install an .inf file that is located in the base directory of the .bat file. I managed to install the .inf, but only if I specify the full directory. How can I install the .inf file without specifying the full directory?

Here's what I have so far:

%SystemRoot%\System32\InfDefaultInstall.exe "DroidInstaller.inf"

Any help would be greatly appreciated.

Was it helpful?

Solution

Your question is quite vague. If both files (your installer.bat and the inf file) are in the same directory then you can add pushd "%~dp0" at the start of your batch-script:

@echo off
pushd "%~dp0"
%SystemRoot%\System32\InfDefaultInstall.exe "DroidInstaller.inf"

This will set the working directory to the directory where your batch-script runs in. If this directory is the same as the directory of your inf file then you are able to call the DroidInstaller.inf the way you did in your question.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top