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

前端 未结 9 1689
佛祖请我去吃肉
佛祖请我去吃肉 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:56

    You can use:

    if not exist "C:\VTS\" mkdir "C:\VTS"
    

    You can also expand the code to replace any missing expected files.

    if not exist "C:\VTS\important.file" echo. > "C:\VTS\important.file"
    

提交回复
热议问题