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

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

    i created this for my script I use in my work for eyebeam.

    :CREATES A CHECK VARIABLE
    
    set lookup=0
    
    :CHECKS IF THE FOLDER ALREADY EXIST"
    
    IF EXIST "%UserProfile%\AppData\Local\CounterPath\RegNow Enhanced\default_user\" (set lookup=1)
    
    :IF CHECK is still 0 which means does not exist. It creates the folder
    
    IF %lookup%==0 START "" mkdir "%UserProfile%\AppData\Local\CounterPath\RegNow Enhanced\default_user\"
    

提交回复
热议问题