Batch file 批处理脚本-将某些内容导入不存在文件夹中的文件

Batch file 批处理脚本-将某些内容导入不存在文件夹中的文件,batch-file,pipe,Batch File,Pipe,是否有可能在一个不存在的文件夹中通过管道传输某些内容,例如 "bla bla" > .\nonexisitngFolder\bla.txt 上面给出了这个错误: The system cannot find the path specified. 或者它只是像这样工作 mkdir .\nonexisitngFolder "bla bla" > .\nonexisitngFolder\bla.txt 我非常确定,如果要向目录输出文件,它必须存在。 你能提供更多关于你想做什么的背景

是否有可能在一个不存在的文件夹中通过管道传输某些内容,例如

"bla bla" > .\nonexisitngFolder\bla.txt
上面给出了这个错误:

The system cannot find the path specified.
或者它只是像这样工作

mkdir .\nonexisitngFolder
"bla bla" > .\nonexisitngFolder\bla.txt

我非常确定,如果要向目录输出文件,它必须存在。
你能提供更多关于你想做什么的背景资料吗?

我是用外交部的解决方案做的

if not exist nonexistingFolder mkdir nonexistingFolder
"bla bla" > .\nonexistingFolder\bla.txt

命令
mkdir
可以创建文件夹树(一次创建多个文件夹)。但是Windows内核中的文件创建例程要求文件的文件夹已经存在。因此,如果不存在“文件夹\树\文件\”mkdir“文件夹\树\文件\”,最好使用
如果文件夹树中至少缺少on,则为该文件创建所有文件夹。当目标新文件的目录不存在时,DOS/cmd.exe shell不具备自动创建目录的功能。我从ruby IO.popen调用makefile(commandString,“r+”)并希望管道输出始终位于同一目录中的同一文件中。文件夹可以存在,但不一定存在。