Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Problem on If exist...  (Read 3254 times)

0 Members and 1 Guest are viewing this topic.

yowy777

    Topic Starter


    Starter

    • Experience: Beginner
    • OS: Unknown
    Problem on If exist...
    « on: July 16, 2012, 09:40:11 PM »
    This is my code:
    Quote
    @echo off
    MODE CON: COLS=80 LINES=20
    Color f0
    if exist /BGMBackup/ goto :continue else goto :backup
    :backup
    md "BGMBackup" 2>nul
    md "BGMOriginal" 2>nul
    copy /b "\bgm\*" "\BGMBackup"
    copy /b "\bgm\*" "\BGMOriginal"
    TIMEOUT 5 >nul
    if exist \BGMBackup goto :edit
    :continue
    Color f0
    copy /b "\BGMOriginal\*" "\BGM\"
    start MyLauncher.exe
    TIMEOUT 16 >nul
    copy /b "\bgmedit\*" "\BGM\"
    COLOR f2
    echo: You can now start!!
    TIMEOUT 5 >nul
    exit
    :editado
    Color f0
    start MyLauncher.exe
    TIMEOUT 16 >nul
    copy /b "\bgmedit\*" "\BGM\"
    COLOR f2
    echo: You can now start!!
    TIMEOUT 5 >nul
    exit
    I want to check if the folder is there... but i don't know the code ...

    foxidrive



      Specialist
    • Thanked: 268
    • Experience: Experienced
    • OS: Windows 8
    Re: Problem on If exist...
    « Reply #1 on: July 17, 2012, 02:41:20 AM »
    Quote
    if exist /BGMBackup/ goto :continue else goto :backup

    The line above should be expressed like this.

    if exist "\BGMBackup\" (goto :continue) else (goto :backup)


    Your code creates folders in the current directory but then copies file explicitly to root folders.  That's a recipe for failure.
    Change the MD commands so they create root folders too.