当前位置:网站首页>Batch create / delete files, folders, modify file name suffixes

Batch create / delete files, folders, modify file name suffixes

2022-06-22 10:36:00 Ah Fei

use bat Batch modify file name , Suffix name , Name the file names as regular

use bat Batch production file name 、 Folder

establish / Folder md/mkdir folderName Delete folder : rd/rmdir folderName
establish / Delete file
Batch change file suffix
Change the file name to regular , With prefix
Various files are customized

One 、 establish / Delete folder

command :md The name of the folder you want to create or mkdir The name of the folder you want to create

Two 、 establish / Delete file

1. Create an empty file

Empty file , There is nothing in the created file , Is an empty file

command type nul> The file name of the file you want to create

example : type nul> My movie .txt
Created a My movie .txt file

2. Create a non empty file

Non empty file , When you execute the command, you play with what is written in the file , There is something in the document

command echo What you want to write into the file you create > The file name of the file you want to create

3. Delete file

command del You want to delete the file name of the file

3、 ... and 、 Batch change file suffix 、

command : ren * .png *.jpg

 Insert picture description here

example :

  1. Create a new text document in the folder of the file name to be modified
  2. Enter the command

 Insert picture description here
3. Save the text document , Change the suffix to bat, Double click the file , Carry out orders Be sure to change the suffix to bat, If the suffix is not displayed in win10 Midpoint 【 see 】 ⇒ hold 【 File extension 】 Check on

 Insert picture description here
 Insert picture description here complete  Insert picture description here

If the suffix name of any file has to be changed , hold The suffix to be modified is changed to * Number , If you want to change the suffix names of all files to txt ren *.* *.txt

Four 、 Change the file name to regular , With prefix

  1. Create a new text file in the folder of the file name to be modified
  2. Enter the following
@echo off
set a=0
setlocal EnableDelayedExpansion
for %%n in (*.jpg) do (
set /A a+=1
ren "%%n" " Prefix content !a! Suffix content .png"
)

among :.jpg It can be changed to the suffix of the file you want to modify , The suffix after the prefix is set by yourself ,!a! Represents a variable , from 0 Start to increase in turn , .png Is the changed suffix
3. preservation , Change the suffix to bat
4. Double click execute , Modification successful
 Insert picture description here
I put it all jpg The suffix was changed to png, Change the prefix to picture -, The same goes for the rest

5、 ... and 、 Various files are customized

In fact, I learned the above commands , combining execl The function of , You can quickly generate many files you want , execl I won't explain it here

原网站

版权声明
本文为[Ah Fei]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206221014084015.html