I am trying to:
- Create a new directory.
- Rename that directory with the version of a downloaded file.
- Move the downloaded file to that directory, (e.g. 125.0.6422.142).
Here is the pertinent code:
@echo off
setlocal EnableExtensions DisableDelayedExpansion
rem Ensure the Temp directory exists
if not exist "C:Temp" mkdir "C:Temp"
rem Extract version number from the 32-bit installer
for /F "tokens=2 delims==" %%G in ('%SystemRoot%System32wbemwmic.exe DATAFILE where "Name=C:\Temp\googlechromestandaloneenterprise.msi'" GET Version /VALUE') do for /F "delims=" %%H in ("%%G") do set "version=%%H"
rem Create a new folder with the version number
mkdir "C:Temp%version%"
rem Move the downloaded files to the version folder
move /Y "C:Tempgooglechromestandaloneenterprise*.msi" "C:Temp%version%" >nul
rem Notify the user that the download is complete
echo Download complete: C:Temp%version%googlechromestandaloneenterprise.msi and C:Temp%version%googlechromestandaloneenterprise64.msi
pause
However, I’m failing to create new directory, and rename that directory according to the version, so that I can move my file there.
Node - MSI-D00084
ERROR:
Description = Invalid query
A subdirectory or file C:Temp already exists.
Download complete: C:Temp\googlechromestandaloneenterprise.msi and C:Temp\googlechromestandaloneenterprise64.msi
Press any key to continue . . .
New contributor
Mohd Nor Amin Bin Kasmuri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.