通过重定向创建文件批量失败
File creation through redirection fails in batch
你知道为什么我无法创建名为 "aux" 的文件吗?
$ type nul > a.txt
$ type nul > au.txt
$ type nul > aux.txt
File not found.
$ dir /b
a.txt
au.txt
实际上我在使用 GUI 时遇到了同样的问题...这是错误的(可能是错误的)翻译:"Specified peripheral device invalid."。
为什么? Naming Files, Paths, and Namespaces
Do not use the following reserved names for the name of a file:
CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8,
COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also
avoid these names followed immediately by an extension; for example,
NUL.txt is not recommended. For more information, see Namespaces.
怎么样? (但切记,不推荐)
type nul > "\?\%cd%\aux.txt"
请记住,完成后,您将需要
del "\?\%cd%\aux.txt"
AUX 是禁止使用的文件名。
在 Complete List of forbidden file and folder names for windows
中回答
你知道为什么我无法创建名为 "aux" 的文件吗?
$ type nul > a.txt
$ type nul > au.txt
$ type nul > aux.txt
File not found.
$ dir /b
a.txt
au.txt
实际上我在使用 GUI 时遇到了同样的问题...这是错误的(可能是错误的)翻译:"Specified peripheral device invalid."。
为什么? Naming Files, Paths, and Namespaces
Do not use the following reserved names for the name of a file:
CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed immediately by an extension; for example, NUL.txt is not recommended. For more information, see Namespaces.
怎么样? (但切记,不推荐)
type nul > "\?\%cd%\aux.txt"
请记住,完成后,您将需要
del "\?\%cd%\aux.txt"
AUX 是禁止使用的文件名。
在 Complete List of forbidden file and folder names for windows
中回答