Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Batch deployment of simple scripts under windows

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

The deployment project under windows is mainly copy or paste. The following BAT script uses the xcopy command that comes with the system to complete the copy and paste deployment.

1. What is XCOPY?

XCOPY is an extension of COPY, you can copy the specified directory with files and directory structure, but not system files; specify at least one source drive letter, source destination pathname and source file name when you use / S; COPY all files in the source directory and its subdirectories when / S is selected. Unless the / E parameter is specified, / S will not copy the empty directory, if the / S parameter is not specified, XCOPY will only copy the files of the source directory itself, not involving the subdirectories under it; when the / V parameter is selected, the copied sectors will be checked, but the speed will be slowed down.

two。 Script content

=

@ echo off

:: environment variable

Set datapath=E:\ tools\ Automated deployment\ 20170413

:: copy files

Start cmd / k "xcopy% datapath% E:\ apache-tomcat-7.0.47\ webapps / e / s / y"

Start cmd / k "xcopy% datapath% F:\ / e / s / y"

Start cmd / k "xcopy% datapath% G:\ / e / s / y"

Start cmd / k "xcopy% datapath% H:\ / e / s / y"

Start cmd / k "xcopy% datapath% I:\ / e / s / y"

Start cmd / k "xcopy% datapath% J:\ / e / s / y"

Start cmd / k "xcopy% datapath% K:\ / e / s / y"

Start cmd / k "xcopy% datapath% L:\ / e / s / y"

Start cmd / k "xcopy% datapath% M:\ / e / s / y"

Start cmd / k "xcopy% datapath% N:\ / e / s / y"

Start cmd / k "xcopy% datapath% O:\ / e / s / y"

Start cmd / k "xcopy% datapath% P:\ / e / s / y"

Quit

=

3. Script interpretation

Datapath is set to the directory of files that you need to deploy

Explanation of xcopy related parameters:

/ E copy directories and subdirectories, including empty ones.

Same as / S / E. Can be used to modify / T.

/ S copies directories and subdirectories except for empty ones. / Y copies file audit settings (implied / O).

Existing target file.

[is directly overwritten-- Three~ Note] 4. Setup step

(1) map the folders that the remote server needs to deploy to the cost local disk.

Computer right = > Map network drive = > Select the drive letter that needs to be mapped to the local = = > Select the corresponding remote folder

(2) create a BAT file called "automatic deployment", then paste the contents of the script into it and save it.

5. Usage

Put the files and bat files that need to be deployed in a folder called automatic deployment, then modify the contents of the script, and double-click to perform automatic deployment .bat.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report