Create folder with batch but only if it doesn't already exist

前端 未结 9 1727
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-12 09:03

Can anybody tell me how to do the following in in a Windows batch script? (*.bat):

  • Create a folder only if it doesn\'t already exist
9条回答
  •  隐瞒了意图╮
    2020-12-12 09:42

    mkdir C:\VTS 2> NUL
    

    create a folder called VTS and output A subdirectory or file TEST already exists to NUL.

    or

    (C:&(mkdir "C:\VTS" 2> NUL))&
    

    change the drive letter to C:, mkdir, output error to NUL and run the next command.

提交回复
热议问题