I want to create a batch file which copies the original file in the same directory, and creates a new file, but the new file that has been created have a name of the original file + file version.
I tried different scripts, but can't find the solution.
I tried this:
set /p "testVar"="wmic datafile where name="C:\\Users\\user\\Desktop\\Test\\GCM.exe" get Version /value"
copy C:\Users\user\Desktop\Test\GCM.exe C:\Users\user\Desktop\Test\GSM-%testVar%
pause
Here's a batch file that will copy a given
.exewith the version number appended to the filename.Usage examples
Copy
.exefile to same folder as the.exefile is in (omitting--pathtodestimplies this):Copy the
.exefile to a different folder:Simulate copy to a different destination folder than the
.exefile is in. This will echo out theCOPYcommand rather than executing it: