Jump to content

Why is my batch not working?

TheMidnightNarwhal
Go to solution Solved by flexin1981,
echo "--------------------------------------------------------------------------"echo "|  __  __                            ____            _            _      |"echo "| |  \/  |   ___   _ __    _   _    | __ )    __ _  | |_    ___  | |__   |"echo "| | |\/| |  / _ \ | '_ \  | | | |   |  _ \   / _` | | __|  / __| | '_ \  |"echo "| | |  | | |  __/ | | | | | |_| |   | |_) | | (_| | | |_  | (__  | | | | |"echo "| |_|  |_|  \___| |_| |_|  \__,_|   |____/   \__,_|  \__|  \___| |_| |_| |"echo "--------------------------------------------------------------------------"

This seems to work for me adding the "" around the statement. As I have said though I am no expert.

So It opens up and closes when I add the ASCII art menu, why?

 

@[member='Echo'] off:menuCOLOR 0Aecho --------------------------------------------------------------------------echo |  __  __                            ____            _            _      |echo | |  \/  |   ___   _ __    _   _    | __ )    __ _  | |_    ___  | |__   |echo | | |\/| |  / _ \ | '_ \  | | | |   |  _ \   / _` | | __|  / __| | '_ \  |echo | | |  | | |  __/ | | | | | |_| |   | |_) | | (_| | | |_  | (__  | | | | |echo | |_|  |_|  \___| |_| |_|  \__,_|   |____/   \__,_|  \__|  \___| |_| |_| |echo --------------------------------------------------------------------------echo 1) Defragecho 2) I Explorerecho 3) Exitset /p opt=Choisirif %opt% == 1 goto DEFif %opt% == 1 goto DEFif %opt% == 1 goto DEF:DEFstart c:\windows\system32\dfrg.mscgoto menu:IEstart iexplore.exegoto menu:EXIT
Link to comment
Share on other sites

Link to post
Share on other sites

I dont really know this, but i have a feeling it is the quotes that you have in the Ascii 

Link to comment
Share on other sites

Link to post
Share on other sites

I dont really know this, but i have a feeling it is the quotes that you have in the Ascii

I dont really know this, but i have a feeling it is the quotes that you have in the Ascii

Yeah... if I take of the ASCII art it works... but why tho?

Link to comment
Share on other sites

Link to post
Share on other sites

quote marks are usually a "special" character in programming so you need to tell the computer that you just mean a quote and not to do something special with it.

 

try putting a ^ before them.

@[member=Echo] off:menuCOLOR 0Aecho --------------------------------------------------------------------------echo |  __  __                            ____            _            _      |echo | |  \/  |   ___   _ __    _   _    | __ )    __ _  | |_    ___  | |__   |echo | | |\/| |  / _ \ | ^'_ \  | | | |   |  _ \   / _^` | | __|  / __| | ^'_ \  |echo | | |  | | |  __/ | | | | | |_| |   | |_) | | (_| | | |_  | (__  | | | | |echo | |_|  |_|  \___| |_| |_|  \__,_|   |____/   \__,_|  \__|  \___| |_| |_| |echo --------------------------------------------------------------------------echo 1) Defragecho 2) I Explorerecho 3) Exitset /p opt=Choisirif %opt% == 1 goto DEFif %opt% == 1 goto DEFif %opt% == 1 goto DEF:DEFstart c:\windows\system32\dfrg.mscgoto menu:IEstart iexplore.exegoto menu:EXIT

I know the spacing looks funny, but that shouldn't matter

 

disclaimer : I am no batch expert

Link to comment
Share on other sites

Link to post
Share on other sites

quote marks are usually a "special" character in programming so you need to tell the computer that you just mean a quote and not to do something special with it.

 

try putting a ^ before them.

@[member=Echo] off:menuCOLOR 0Aecho --------------------------------------------------------------------------echo |  __  __                            ____            _            _      |echo | |  \/  |   ___   _ __    _   _    | __ )    __ _  | |_    ___  | |__   |echo | | |\/| |  / _ \ | ^'_ \  | | | |   |  _ \   / _^` | | __|  / __| | ^'_ \  |echo | | |  | | |  __/ | | | | | |_| |   | |_) | | (_| | | |_  | (__  | | | | |echo | |_|  |_|  \___| |_| |_|  \__,_|   |____/   \__,_|  \__|  \___| |_| |_| |echo --------------------------------------------------------------------------echo 1) Defragecho 2) I Explorerecho 3) Exitset /p opt=Choisirif %opt% == 1 goto DEFif %opt% == 1 goto DEFif %opt% == 1 goto DEF:DEFstart c:\windows\system32\dfrg.mscgoto menu:IEstart iexplore.exegoto menu:EXIT
I know the spacing looks funny, but that shouldn't matter

 

disclaimer : I am no batch expert

Does not work. Like before, it says syntax incorrect.

Link to comment
Share on other sites

Link to post
Share on other sites

echo "--------------------------------------------------------------------------"echo "|  __  __                            ____            _            _      |"echo "| |  \/  |   ___   _ __    _   _    | __ )    __ _  | |_    ___  | |__   |"echo "| | |\/| |  / _ \ | '_ \  | | | |   |  _ \   / _` | | __|  / __| | '_ \  |"echo "| | |  | | |  __/ | | | | | |_| |   | |_) | | (_| | | |_  | (__  | | | | |"echo "| |_|  |_|  \___| |_| |_|  \__,_|   |____/   \__,_|  \__|  \___| |_| |_| |"echo "--------------------------------------------------------------------------"

This seems to work for me adding the "" around the statement. As I have said though I am no expert.

Link to comment
Share on other sites

Link to post
Share on other sites

echo "--------------------------------------------------------------------------"echo "|  __  __                            ____            _            _      |"echo "| |  \/  |   ___   _ __    _   _    | __ )    __ _  | |_    ___  | |__   |"echo "| | |\/| |  / _ \ | '_ \  | | | |   |  _ \   / _` | | __|  / __| | '_ \  |"echo "| | |  | | |  __/ | | | | | |_| |   | |_) | | (_| | | |_  | (__  | | | | |"echo "| |_|  |_|  \___| |_| |_|  \__,_|   |____/   \__,_|  \__|  \___| |_| |_| |"echo "--------------------------------------------------------------------------"
This seems to work for me adding the "" around the statement. As I have said though I am no expert.

Yes! Thanks!

Link to comment
Share on other sites

Link to post
Share on other sites

I have not used batch hardly at all, but adding backslashes "\" in front of characters such as other backslashes, apostrophes or other special characters may solve this problem.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×