Automatically unzip files on Windows share under Windows

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.