Welcome to Dream.In.Code
Getting Help is Easy!

Join 136,584 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,958 people online right now. Registration is fast and FREE... Join Now!




Error with simple Batch File

 
Reply to this topicStart new topic

Error with simple Batch File

C++ Programmer
4 Oct, 2008 - 10:11 AM
Post #1

New D.I.C Head
*

Joined: 12 Jun, 2008
Posts: 29


My Contributions
Ok, when you type what game you want it to open....it doesnt open it, can someone show me the proper way to use the CALL command.

CODE
@echo off
:beginning
cls
title Games or Programs
echo Which would you like to list?
echo -----------------------------
echo Games
echo -----------------------------
echo Programs
echo -----------------------------
set /p input=Answer
if %input% == dfgfd goto invalid
if %input% == Games goto games
if %input% == games goto games
if %input% == GAMES goto games
if %input% == Programs goto programs
if %input% == programs goto programs
if %input% == PROGRAMS goto programs

:invalid
cls
title Invalid
echo I'm sorry, but that is an invalid operation.
pause
goto beginning

:games
cls
title Games
echo Which game would you like to open?
echo TIP: Type "ListGames" for more choices.
echo TIP: Type "Programs" to goto programs.
echo ----------------------------------
echo FreeCell
echo ----------------------------------
echo Hearts
echo ----------------------------------
set /p input=Answer
if %input% == dfgdfg goto invalid
if %input% == Programs goto programs
if %input% == programs goto programs
if %input% == PROGRAMS goto programs
if %input% == ListGames goto listgames
if %input% == Listgames goto listgames
if %input% == listGames goto listgames
if %input% == LISTgames goto listgames
if %input% == listGAMES goto listgames
if %input% == LISTGAMES goto listgames
if %input% == FreeCell goto freecell
if %input% == Freecell goto freecell
if %input% == freeCell goto freecell
if %input% == FREEcell goto freecell
if %input% == freeCELL goto freecell
if %input% == FREECELL goto freecell
if %input% == Hearts goto hearts
if %input% == hearts goto hearts
if %input% == HEARTS goto hearts

:listgames
cls
title Listing of Games
echo Here is all the games that we have in stock at this moment.
echo TIP: Type "Programs" to goto programs.
echo TIP: For "Spider Solitaire" please type "Spidersolitaire"
echo ----------------------------------
echo FreeCell
echo ----------------------------------
echo Hearts
echo ----------------------------------
echo Minesweeper
echo ----------------------------------
echo Solitaire
echo ----------------------------------
echo Spider Solitaire
echo ----------------------------------
set /p input=Answer
if %input% == dfgdfg goto invalid
if %input% == Programs goto programs
if %input% == programs goto programs
if %input% == PROGRAMS goto programs
if %input% == ListGames goto listgames
if %input% == Listgames goto listgames
if %input% == listGames goto listgames
if %input% == LISTgames goto listgames
if %input% == listGAMES goto listgames
if %input% == LISTGAMES goto listgames
if %input% == FreeCell goto freecell
if %input% == Freecell goto freecell
if %input% == freeCell goto freecell
if %input% == FREEcell goto freecell
if %input% == freeCELL goto freecell
if %input% == FREECELL goto freecell
if %input% == Hearts goto hearts
if %input% == hearts goto hearts
if %input% == HEARTS goto hearts
if %input% == Minesweeper goto minesweeper
if %input% == minesweeper goto minesweeper
if %input% == MINESWEEPER goto minesweeper
if %input% == Soliraire goto solitaire
if %input% == solitaire goto solitaire
if %input% == SOLITAIRE goto solitaire
if %input% == SpiderSolitaire goto spider
if %input% == Spidersolitaire goto spider
if %input% == spiderSolitaire goto spider
if %input% == SPIDERsolitaire goto spider
if %input% == spiderSOLITAIRE goto spider
if %input% == SPIDERSOLITAIRE goto spider

:freecell
cls
CALL ("%SystemRoot%\system32\freecell.exe"
goto listgames

:hearts
cls
CALL ("%SystemRoot%\system32\mshearts.exe")
goto listgames

:minesweeper
cls
CALL ("%SystemRoot%\system32\winmine.exe")
goto listgames

:solitaire
cls
CALL ("%SystemRoot%\system32\sol.exe")
goto listgames

:spider
cls
CALL ("%SystemRoot%\system32\spider.exe")
goto listgames


I know its not finished....but i'm not working on the programs until i know how to do CALL commands.

Thank you







User is offlineProfile CardPM
+Quote Post

David W
RE: Error With Simple Batch File
9 Oct, 2008 - 06:27 AM
Post #2

D.I.C Regular
Group Icon

Joined: 20 Sep, 2008
Posts: 315



Thanked: 16 times
Dream Kudos: 275
My Contributions
QUOTE

I know its not finished....but i'm not working on the programs until i know how to do CALL commands.

Thank you


You maybe don't have to call them ... and you can probably drop all the (" ") stuff

Quotes ".... ..." are only used/needed if there are spaces in the file address ...

I did a little test ... and these worked ok ...

call notepad numbers.txt

notepad numbers.txt

These didn't ...

call "notepad numbers.txt"

call ("notepad numbers.txt")

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 12:47AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month