C # uses batch processing to implement automatic updates of running programs

Source: Internet
Author: User
Tags empty file copy

About Automatic Updates, under. NET has been very common things, nothing more than in the server to save the configured to update the program, and then the client to write a small program to detect, there is an updated copy over. So the idea, such a simple question to account for a home page? But don't worry, look at my headline, Then slowly look down, perhaps one day, you may really need it, even if not, I believe that you will review the command is also good AH!

Using Sharedevelop's Icsharpcode.core to implement a plug-in application, these two days want to get an automatic update, the update function as a plug-in included in the application, originally thought that according to the above idea is very easy to achieve, also did realize the part, why say part of it, Because the main EXE file has not been updated successfully! Think about the reason is also very simple: the main EXE itself is running, in the runtime of the EXE or DLL can not be covered. Now, what do we do? Then an idea emerges, first the main EXE process to kill, and then copy it? Well, it seems to be the truth. After committing suicide, naturally can copy come over Ah, but then think again, if the main EXE itself does not exist, then the replication function how to carry out it? Because not bad money, money can make the mare, Master exe a?

The world is certainly no ghost, even if there is, it can not be so powerful to help the main EXE, in the seat of mind always suicidal and reborn this program. Google,baidu These great gods have not found a good solution, had to retreat. It seems that only by self-reliance, of course, this may not work, but at least tried ...

It's just a copy, isn't it? is copy ah, hundred no clue, I in cmd (I generally will open cmd), the unconscious knock on the copy/?,xcopy/? Sort of view, where Xcopy's help is really reminding me, please look below: (traditional system, pasted over, so no have converted to Simplified)

Xcopyhelp
C:\>xcopy/?
Copy files and tree directories.

XCOPY source [Destination] [/a |/M] [/d[:d ate]] [/p] [/S [/e]] [/v] [/w]
[/C] [I] [/Q] [/F] [/L] [/g] [/h] [/R] [/T] [/u]
[/k] [/n] [/O] [/x] [/y] [/-y] [/z] \r\r
[/exclude:file1[+file2][+file3]]

SOURCE specifies the file to copy.
Destination the name of the specified location or/and the new file.
/A copy only the file set to save the property, do not change the property settings.
/M Copy only the file set to save the property and clear the Save property.
/d:m-d-y copies files that have changed on or after the specified date. If no date is given,
Copy only those source files date than the destination file date for the new file.
/EXCLUDE:FILE1[+FILE2][+FILE3]
Specifies the file list string. Each string
Different lines should be in the file. If a string corresponds to a file that you want to copy, never
For any part of the path, this file will be excluded from replication. For example, specify a string
\obj\ or. obj, all exclusions under the OBJ directory name are
File copy of. obj.
/P displays a prompt when each destination file is established.
/S copies each directory and its contained subdirectories, and does not copy empty directories.
/e copies each directory and its contained subdirectories, as well as an empty directory./s and/e
Same, can be used to modify/T.
/V verifies each new file.
/w prompts you to press the key to continue before copying.
/C Continue copying if the error occurs.
/I if the purpose does not exist and copies more than one file, assume that the specified
The purpose must be the directory.
/q Do not display file names when copying.
/F Displays all file names for the source and destination files at copy time.
/L Displays the file to be copied.
/g allows encrypted files to be copied to a file that does not support encryption
Destination.
Copy hidden and system files when/h.
/R overrides read-only files.
/T establishes the directory structure, but does not copy the files therein. Empty directories and subdirectories are not included.
/T/E will include an empty directory and subdirectories.
/U copies only files that already exist in the destination location.
/k copy file attributes. Typically Xcopy resets a read-only property.
/n uses the resulting short file name to replicate.
/o Copy file ownership and ACL information.
/x Copy file review settings (including/O).
/y Do not prompt you to confirm that you want to overwrite an existing file.
/-y you to confirm that you want to overwrite an existing file.
/z Copies the network files in a restart mode.

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.