Schtasks/create Scheduled Task Chinese path name to add "" subcommand/tn/tr before the space will be wrong

Source: Internet
Author: User
Tags schtasks


EchooffEcho. Empty the connection net use*/del/yEcho. Connect net use \ \192.168.1.2\ Human Resources department \ Attendance \ Attendance Data-Little MO provides"Password"/USER:"User name"Echo. Copy--and-Force override Xcopy"D:\2015Program Files\zkteco\att2000.mdb" "\\192.168.1.2\ Human Resources department \ Attendance \ Attendance Data-Xiao Mo provides"/Y/S/E


These are action scripts .

schtasks  /create  /tn "scheduled update attendance data"  /sc daily  /st 13:00:00    /tr "D:\2015Program files\ back up to the server. bat "

echo. Chinese path
Echo.   schtasks his sub-command    /tn    /tr in front of the   space otherwise it will go wrong

The above is the play action Script

XCOPY is an extension of copy, you can copy the specified directory files and directory structure, but not the system files; Use the source drive character, source destination pathname, source file name at least one; Select/s to copy all files under the source directory and its subdirectories. Unless you specify the/e parameter,/s does not copy an empty directory, and if you do not specify the/s parameter, xcopy copies only the files of the source directory itself, not the subdirectories below it, and when you choose the/v parameter, the sectors of the copy are compared, but the speed is reduced.

We can not ancestors, the study is to learn, should not forget or can not forget, especially DOS batch processing commands, in the development of software or projects, are inseparable from these basic original commands. In this paper, we will study the parameters and examples of xcopy

First, the Xcopy parameter introduction

Command format: XCOPY source [destination] a bunch of optional parameters
parameter describes
source specifies the file to be copied. The
destination Specifies the location and/or name of the new file.
/A copies only the files with the archive attribute set, but does not change the properties.
/M copies only the files with the archive attribute set and closes the archive properties.
/d:m-d-y copies files that change after a specified date or a specified date. If no date is provided, only those files that have the source time newer than the target time are copied.
/exclude:file1[+file2][+file3] ... The
specifies a list of files that contain strings. If any string matches the absolute path of the file to be copied, the file will not be copied.
For example, specifying a string such as \obj\ or. obj excludes all files under directory obj or files with an. obj extension.
/P prompts before each target file is created.
/S copies directories and subdirectories, except for empty.
/e copies directories and subdirectories, including empty. Same as/s/e. Can be used to modify/T.
/V verifies each new file.
/w prompts you to press the key before copying.
/C Continue copying even if there is an error.
/I if the target does not exist and you are copying more than one file, assume that the destination must be a directory.
/q does not display the file name when copying. The full source and destination file names are displayed when
/F is copied.
/L Displays the files to be copied. The
/g allows files that are not encrypted to be copied to targets that do not support encryption.
/h also copies hidden and system files.
/R overwrites read-only files.
/T Creates a directory structure, but does not copy files. Empty directories or subdirectories are not included. /T/E includes empty directories and subdirectories.
/U copies only files that already exist in the target. The
/k copy property. General Xcopy resets the read-only property.
/n is copied with the generated short name.
/o copies file ownership and ACL information.
/x Copies the file audit settings (implied/O).
/y Suppresses prompting to confirm overwriting an existing target file.
/-y causes a prompt to confirm overwriting an existing target file.
/z copies network files in restart mode.

Second, the Xcopy command example introduction

  ① an instance of a native copy of a file or folder

Copy CodeThe code is as follows:
Xcopy d:\UpdateFiles e:\123/s/e/y

Command explanation: Copy all of the contents contained in the Updatefiles folder of the D drive to the 123 folder on the E drive;/s/e/y parameter description: When copying files, also copy empty directories or subdirectories, if the target path already has the same file, use the Overwrite method without prompting.

  Application example of ② in LAN

Copy CodeThe code is as follows:
Xcopy \\192.168.0.168\UpdateFiles e:\123/s/e/y

Command explanation: Will 192.168.0.168 this computer name is updatefiles in the folder of all things, all copied to the local e:\123 folder; parameter description: Copy the file as well as the empty directory or subdirectory, if the target path already has the same file, Use the override method without prompting.

③ with the/d tag, which enables copying only new files than the target file

If now all the files under the C:\a folder are the same as the files under D:\a (modified date and content)

A file under C:\a has been modified by someone else or added a file!
Can you write a bat to determine the last modification date for each file under the C:\a folder is not in the first two days! If it is, it is copied to the appropriate directory under D:\A (if it is, overwrite it), if not, it is not copied.

Copy CodeThe code is as follows:
@echo off
echo y|xcopy c:\a/d/e/r/k d:\a\
Pause

Tested if the destination file is the same as the source file, it is not copied. To a certain extent, reduce the read and write to the hard disk.

Articles you may be interested in:
    • xcopy only copy the implementation code of the day file
    • Advanced use of xcopy: Specify a date and exclude the specified file with exclude
    • Bat+xcopy implementation only copies files that are newer than the target file
    • Method of using Xcopy command to copy local file to remote server
    • xcopy implements batch copy files or folders
    • Talk about the exclude copy in Xcopy
    • Xcopy copies files and directories, including subdirectories.
    • Summary of differences between copy and XCOPY commands in batch processing

Schtasks/create Scheduled Task Chinese path name to add "" subcommand/tn/tr before the space will be wrong

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.