REM mkdir C:\build
MD c:\build
REM Mount the Windows share to Z Drive
NET use x: \\172.16.10.240\Infa_Shared\Infa_Build\Mercury\AT_build\Windows
REM Start unzip Windows build to local machine, no need to copy
X:
for/f "delims=|"%%i In (' DIR ' * * "/b/o:d ') do SET newest=%%i
Start winrar x%newest% c:\build
Knowledge Points:
1. REM is the bat annotation
2. Basic commands such as MD copy del
3. NET use maps shared path to disk
4. Start WinRAR x%newest% c:\build with winrar decompression
5. for/f "delims=|"%%i In (' DIR ' * * "/b/o:d ') do SET newest=%%i Get the latest file, assign a value to the variable newest
6. The difference between% and percent
%%i This variable is a specific variable within the FOR statement (there is also an external variable, the format of the accept external parameter is%1-%9 a total of 9 variables),
Only two percent number is written in the batch to represent the variable, and only one% is used in the CMD. Anyway, as long as you use for in the batch file, the variables are used in percent.
Automatically unzip files on Windows share under Windows