Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Shell 

Super, super basic batch help..?

Can someone explain what I am doing wrong here..?

As soon as I run the program it opens and closes immediately :/

It worked fine until I added the "if exist" shit, so presumably the syntax in there is fucked. I've never really used the "if" statement, so please take it easy on me :)

Code
@echo off

:CreateDataBase
    if exist "C:\Documents and Settings\Admin\database.txt"
    (
        goto Start
    )
    echo DATABASE SUCCESSFULLY CREATED >database.txt

:Start
    set /p account=Do you have an account?
        if %account%==yes goto Login
        if %account%==no goto Create

:Create
    cls
    set /p newusername=Please enter your new username:
    findstr /m "%newusername%" database.txt
    if %errorlevel%==0
    (
        goto NameInUse
    )
    goto NewPass
    
:NameInUse
    echo Error... Username is already taken! Please try again.
    pause>nul
    goto Create

:NewPass
    set /p newpass=Please choose a password:
    echo %newusername%--%newpass% >>database.txt
    echo Account Created! Please Login.
    pause>nul
    goto Login
I would make the first parenthesis AFTER the " with a space between it.
Code
@echo off
:CreateDataBase
if exist "C:\Documents and Settings\Admin\database.txt" (
goto Start
    )
echo DATABASE SUCCESSFULLY CREATED >database.txt
:Start
set /p account=Do you have an account?
(Sep 28, 2012 03:28 PM)DesuDesuDesuDesu Wrote:  I would make the first parenthesis AFTER the " with a space between it.
Code
@echo off
:CreateDataBase
if exist "C:\Documents and Settings\Admin\database.txt" (
goto Start
    )
echo DATABASE SUCCESSFULLY CREATED >database.txt
:Start
set /p account=Do you have an account?

Why thank you! It worked, im used to JAVA formatting I guess.. Can someone else +rep him for being helpful? :B I would, but well you know..


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by Robert RougeSep 24, 2026 10:02 AM 4 221 Sep 24, 2026 10:02 AM
Last Post: Anonynuk
[Shell] by Cyber-SecurityAug 8, 2022 10:24 AM 1,283 120,035 Aug 8, 2022 10:24 AM
Last Post: Ber63
[Shell] by fisica638Oct 30, 2019 11:05 AM 1 536 Oct 30, 2019 11:05 AM
Last Post: Hackoo