Alexander
Alexander

Reputation: 20224

Retrieve EXE file version from file in current directory

I have a batch script that is in version control and can be checked out into any directory, but it should only work on the current directory:

@echo off
zip -9 Setup.zip Setup.exe SetupGuide.pdf

Now the batch file should retrieve from Setup.exe the version, check a network drive whether the file Setup.<versionstring>.zip exists and throw an error if it does, or else copy the Setup.zip to the network drive as Setup.<versionstring>.zip.

I found that I can get the version string using WMIC, but it seems to only take the full path name and furthermore needs double backslashes. How can I tell WMIC that I want a file from the current directory?

T:\Installer\SetupFiles>wmic datafile where name='.\\Setup.exe' get version
Keine Instanzen verfügbar.

Upvotes: 0

Views: 122

Answers (1)

aschipfl
aschipfl

Reputation: 34909

I think you need to provide the full path to the executable:

wmic datafile where name="T:\\Installer\\SetupFiles\\Setup.exe" get version

Upvotes: 1

Related Questions