In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to achieve replace file replacement in cmd, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand it.
Help Information:
Replace the file.
REPLACE [drive1:] [path2] filename [drive2:] [path3] [/ A] [/ P] [/ R] [/ W]
REPLACE [drive1:] [path2] filename [drive2:] [path3] [/ P] [/ R] [/ S] [/ W] [/ U]
[drive1:] [path2] filename specifies the source file.
[drive2:] [path3] specifies the directory where you want to replace the file.
/ An add the new file to the target directory. Cannot be used with / S or / U command line switch
Use it.
/ P you will be prompted for confirmation before replacing the file or adding the source file.
/ R replaces read-only files and unprotected files.
/ S replaces the files of all subdirectories in the target directory. Cannot be matched with / A command switch
Match it with.
/ W wait until you insert the disk before running.
/ U only replaces or updates files that are older than the source file. Cannot be associated with / A command line
Switch is used in combination.
Command summary:
Replace, all English replace, meaning: replace; under the jurisdiction of 6 parameters.
The code is as follows:
REPLACE [drive1:] [path2] filename [drive2:] [path3]
Conditions for the use of replace:
According to the syntax, there are two conditions for using a smooth rod replace
1. Replace and replace the file with the same name (according to: the target has only the file path, no file name)
two。 Two files must be in different paths (according to: files with the same name cannot be in the same folder)
It has been tested that this is true.
Parameter description: / An add the new file to the target directory. Cannot be used with / S or / U command line switches.
/ a, English full name add, meaning: add.
The / a parameter cannot be used with / s and / u.
The / a parameter is not so much "add the new file to the target directory" as "copy the new file to the target directory", so raplace / a can be used as copy / y, but pay attention to the syntax differences.
Example: copy 1.txt to the root directory of disk c:
The code is as follows:
C:\ Users\ HELLOW~1\ Desktop > replace / a 1.txt c:\
/ P you will be prompted for confirmation before replacing the file or adding the source file.
/ p, English full name prompt, meaning: prompt.
As the name implies, it is the hint, the effect:
The code is as follows:
C:\ Users\ HELLOW~1\ Desktop > replace / p 1.txt c:\
Do you want to replace C:\ 1.txt? (Ybig N)
The code is as follows:
/ R replaces read-only files and unprotected files.
/ r, English full name read, meaning: read; here it can be extended as a read-only file.
There is such a parameter, it can be predicted that replace can not replace read-only files by default, which is true after testing.
The code is as follows:
C:\ Users\ HELLOW~1\ Desktop > attrib + r c:\ 1.txt
C:\ Users\ HELLOW~1\ Desktop > replace 1.txt c:\
Access denied-C:\ 1.txt
File not replaced
C:\ Users\ HELLOW~1\ Desktop > replace / r 1.txt c:\
Replacing C:\ 1.txt
The code is as follows:
/ S replaces the files of all subdirectories in the target directory. Cannot be used with the / A command switch.
/ s, English full name subdirectory, meaning: subdirectory.
/ s can replace the files of all subdirectories under the specified directory
For example, there are two txt files whose full path is c:\ 1.txt c:\ hello\ 1.txt, and replace them all at once with the / s parameter.
The code is as follows:
C:\ Users\ HELLOW~1\ Desktop > replace / s / r 1.txt c:\
Replacing C:\ 1.txt
Replacing C:\ hello\ 1.txt
The code is as follows:
/ W wait until you insert the disk before running.
/ w, English full name wait, meaning: wait.
This command does not explain, disk should refer to floppy disk; from this command, it is not difficult to see that "kiss to death" has only a "self-cherished" feeling for cmd.exe, and there is no strong love for "I love you,I need you,I want you" who "keeps pace with the times". Yes, windows doesn't love cmd, he just cherishes her.
/ U only replaces or updates files that are older than the source file. Cannot be associated with / A command line
Switch is used in combination.
/ u, English full name update, meaning: update.
This parameter is amazing, and the parameter of number in replace is the most attractive to me.
For example: create two texts first, c disk first, d disk later
The code is as follows:
C:\ Users\ HELLOW~1\ Desktop > echo I'm first! > c:\ 1.txt
C:\ Users\ HELLOW~1\ Desktop > echo I'm Second! > d:\ 1.txt
Then add the / u parameter to replace c:\ 1.txt to disk d
The code is as follows:
C:\ Users\ HELLOW~1\ Desktop > d:\ 1.txt
C:\ Users\ HELLOW~1\ Desktop > replace / u c:\ 1.txt d:\
C:\ Users\ HELLOW~1\ Desktop > type d:\ 1.txt
Ichimm Second!
You can see that the 1.txt of disk d has not been replaced. Why? Because d:\ 1.txt is created after c:\ 1.txt, in other words: d:\ 1.txt is newer than c:\ 1.txt.
If this is the case, then the reverse is naturally true:
The code is as follows:
C:\ Users\ HELLOW~1\ Desktop > replace / u d:\ 1.txt c:\
Replacing C:\ 1.txt
C:\ Users\ HELLOW~1\ Desktop > type c:\ 1.txt
Ichimm Second!
Thank you for reading this article carefully. I hope the article "how to replace replace files in cmd" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.