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

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




Bat2exe /or bat2com to rename to exe

2 Pages V  1 2 >  
Closed TopicStart new topic

Bat2exe /or bat2com to rename to exe, error with running program

coaster3000
post 30 Aug, 2008 - 02:27 PM
Post #1


D.I.C Head

**
Joined: 28 Aug, 2008
Posts: 79


My Contributions


Hi its me again and i have just compiled my program you know the Random Event generator This coding

CODE
@ECHO OFF
ECHO Welcome to the random event generator V1.5
ECHO Warning this is a Beta File!
ECHO This program is now fully functional and will be very easy to use.
Pause
:LOOP
ECHO Please enter event type. . . .
SET /p type=
IF %type%==Weather GOTO Weather
IF %type%==weather GOTO Weather
IF %type%==Dissaster GOTO Dissaster
IF %type%==dissaster GOTO Dissaster

:Weather
SET /a var=%random% %% 112
IF %var%==1 SET string= Sunny
IF %var%==2 SET string= Sunny
IF %var%==3 SET string= Sunny
IF %var%==4 SET string= Sunny
IF %var%==5 SET string= Sunny
IF %var%==6 SET string= Sunny
IF %var%==7 SET string= Sunny
IF %var%==8 SET string= Sunny
IF %var%==9 SET string= Sunny
IF %var%==10 SET string= Sunny
IF %var%==11 SET string= Sunny and Windy
IF %var%==12 SET string= Sunny and Windy
IF %var%==13 SET string= Sunny and Windy
IF %var%==14 SET string= Sunny and Windy
IF %var%==15 SET string= Sunny and Windy
IF %var%==16 SET string= Hot and Sunny
IF %var%==17 SET string= Hot and Sunny
IF %var%==18 SET string= Hot and Sunny
IF %var%==19 SET string= Hot and Sunny
IF %var%==20 SET string= Hot and Sunny
IF %var%==21 SET string= Hot and Sunny
IF %var%==22 SET string= Hot and Sunny
IF %var%==23 SET string= Cold and Sunny
IF %var%==24 SET string= Cold and Sunny
IF %var%==25 SET string= Cold and Sunny
IF %var%==26 SET string= Cold and Sunny
IF %var%==27 SET string= Cold and Sunny
IF %var%==28 SET string= Cold and Sunny
IF %var%==29 SET string= Cold and Sunny
IF %var%==30 SET string= Rain
IF %var%==31 SET string= Rain
IF %var%==32 SET string= Rain
IF %var%==33 SET string= Rain
IF %var%==34 SET string= Heavy Rain
IF %var%==35 SET string= Heavy Rain
IF %var%==36 SET string= Heavy Rain
IF %var%==37 SET string= Heavy Rain
IF %var%==38 SET string= Heavy Rain
IF %var%==39 SET string= Heavy Rain
IF %var%==40 SET string= Rain
IF %var%==41 SET string= Rain
IF %var%==42 SET string= Rain
IF %var%==43 SET string= T_Storm
IF %var%==44 SET string= T_Storm
IF %var%==45 SET string= T_Storm
IF %var%==46 SET string= T_Storm
IF %var%==47 SET string= T_Storm
IF %var%==48 SET string= T_Storm
IF %var%==49 SET string= T_Storm
IF %var%==50 SET string= Severe T Storm
IF %var%==51 SET string= Severe T Storm
IF %var%==52 SET string= Severe T Storm
IF %var%==53 SET string= Severe T Storm
IF %var%==54 SET string= Severe T Storm
IF %var%==55 SET string= Severe T Storm With Hail
IF %var%==56 SET string= Severe T Storm With Hail
IF %var%==57 SET string= Severe T Storm With Hail
IF %var%==58 SET string= Severe T Storm With Hail
IF %var%==59 SET string= Severe T Storm With Hail
IF %var%==60 SET string= Severe T Storm With Hail And Wind
IF %var%==61 SET string= Severe T Storm With Hail And Wind
IF %var%==62 SET string= Severe T Storm With Hail And Wind
IF %var%==63 SET string= Severe T Storm With Hail And Wind
IF %var%==64 SET string= Tornado F0
IF %var%==65 SET string= Tornado F0
IF %var%==66 SET string= Tornado F0
IF %var%==67 SET string= Tornado F0
IF %var%==68 SET string= Tornado F0
IF %var%==69 SET string= Tornado F0
IF %var%==70 SET string= Tornado F1
IF %var%==71 SET string= Tornado F1
IF %var%==72 SET string= Tornado F1
IF %var%==73 SET string= Tornado F1
IF %var%==74 SET string= Tornado F1
IF %var%==75 SET string= Tornado F2
IF %var%==76 SET string= Tornado F2
IF %var%==77 SET string= Tornado F2
IF %var%==78 SET string= Tornado F2
IF %var%==79 SET string= Tornado F3
IF %var%==80 SET string= Tornado F3
IF %var%==81 SET string= Tornado F3
IF %var%==82 SET string= Tornado F4
IF %var%==83 SET string= Tornado F4
IF %var%==84 SET string= Tornado F5
IF %var%==85 SET string= Hurricane C1
IF %var%==86 SET string= Hurricane C1
IF %var%==87 SET string= Hurricane C1
IF %var%==88 SET string= Hurricane C1
IF %var%==89 SET string= Hurricane C1
IF %var%==90 SET string= Hurricane C2
IF %var%==91 SET string= Hurricane C2
IF %var%==92 SET string= Hurricane C2
IF %var%==93 SET string= Hurricane C2
IF %var%==94 SET string= Hurricane C3
IF %var%==95 SET string= Hurricane C3
IF %var%==96 SET string= Hurricane C3
IF %var%==97 SET string= Hurricane C4
IF %var%==98 SET string= Hurricane C4
IF %var%==99 SET string= Hurricane C5
IF %var%==100 SET string= Cloudy
IF %var%==101 SET string= Cloudy
IF %var%==102 SET string= Cloudy
IF %var%==103 SET string= Cloudy
IF %var%==104 SET string= Cloudy
IF %var%==105 SET string= Cloudy
IF %var%==106 SET string= Cloudy
IF %var%==107 SET string= Cloudy
IF %var%==108 SET string= Cloudy
IF %var%==109 SET string= Cloudy
IF %var%==110 SET string= Cloudy
IF %var%==111 SET string= Cloudy
ECHO %string%
GOTO Retry
:Dissaster
SET /a var=%random% %% 51
IF %var%==1 SET string= Nothing
IF %var%==2 SET string= Nothing
IF %var%==3 SET string= Nothing
IF %var%==4 SET string= Nothing
IF %var%==5 SET string= Nothing
IF %var%==6 SET string= Nothing
IF %var%==7 SET string= Nothing
IF %var%==8 SET string= Nothing
IF %var%==9 SET string= Nothing
IF %var%==10 SET string= Nothing
IF %var%==11 SET string= Earthquake 1.5
IF %var%==12 SET string= Earthquake 1.5
IF %var%==13 SET string= Earthquake 1.5
IF %var%==14 SET string= Earthquake 1.5
IF %var%==15 SET string= Earthquake 1.5
IF %var%==16 SET string= Nothing
IF %var%==17 SET string= Nothing
IF %var%==18 SET string= Nothing
IF %var%==19 SET string= Nothing
IF %var%==20 SET string= Nothing
IF %var%==21 SET string= Earthquake 2.5
IF %var%==22 SET string= Earthquake 2.5
IF %var%==23 SET string= Earthquake 2.5
IF %var%==24 SET string= Earthquake 3.5
IF %var%==25 SET string= Earthquake 3.5
IF %var%==26 SET string= Earthquake 4.0
IF %var%==27 SET string= Earthquake 5.0
IF %var%==28 SET string= Earthquake 6.0
IF %var%==29 SET string= Earthquake 7.0
IF %var%==30 SET string= Earthquake 8.0
IF %var%==31 SET string= Earthquake 8.1
IF %var%==32 SET string= Earthquake 8.2
IF %var%==33 SET string= Earthquake 8.3
IF %var%==34 SET string= Earthquake 8.4
IF %var%==35 SET string= Earthquake 8.5
IF %var%==36 SET string= Earthquake 8.6
IF %var%==37 SET string= Earthquake 8.7
IF %var%==38 SET string= Earthquake 8.8
IF %var%==39 SET string= Earthquake 8.9
IF %var%==40 SET string= Eartchquake 9.0
IF %var%==41 SET string= Plague
IF %var%==42 SET string= Plague
IF %var%==43 SET string= Plague
IF %var%==44 SET string= Plague
IF %var%==45 SET string= Plague
IF %var%==46 SET string= Nothing
IF %var%==47 SET string= Nothing
IF %var%==48 SET string= Nothing
IF %var%==49 SET string= Nothing
IF %var%==50 SET string= Nothing
ECHO %string%
GOTO Retry
:Retry
ECHO Want to retry??? Y OR N
SET /p yn=
IF %yn%==y GOTO LOOP
IF %yn%==n GOTO END
:END


Well i have compiled it right to a com then renamed it to a exe file and guess what when i run it it shows the starting message then when i hit enter it just shuts down. the same with any other key... can you please help me thanks
User is offlineProfile CardPM

Go to the top of the page

gabehabe
post 31 Aug, 2008 - 06:03 AM
Post #2


Working Girl.

Group Icon
Joined: 6 Feb, 2008
Posts: 5,402



Thanked 94 times

Dream Kudos: 2625

Expert In: Dingleberries

My Contributions


You compiled it to a com? You can't just change the extension and expect it to work.

Here, I use this: [click]

I'm gonna make my own bat2exe though, it's easy enough~

Anyway, I digress.

I'm looking over your program now, there's a lot of unnecessary stuff in it, and you actually use the random numbers wrong. The range will start from 0, not 1.

I'll fix your code, and post it here when it's done. icon_up.gif

edit:
Here. I'm not sure why you repeat the if to set the string to the same thing, I assume it's just to make it more likely for a smaller event?

Anyway, you could do it with something like this to greatly reduce your code:
IF %var% lss 5 (echo %var% is either 0,1,2,3 or 4)

Here's a little thing I threw together to try to show you how you can have multiple conditions:
CODE
@echo off
set /a var = %random% %% 10
if %var% lss 4 (echo %var% is either 0,1,2 or 3)
if %var% gtr 3 if %var% lss 8 == (echo %var% is either 4,5,6 or 7)
if %var% gtr 7 (echo %var% is either 8 or 9)
pause


Hope this helps smile.gif
User is offlineProfile CardPM

Go to the top of the page

coaster3000
post 31 Aug, 2008 - 09:30 AM
Post #3


D.I.C Head

**
Joined: 28 Aug, 2008
Posts: 79


My Contributions


QUOTE(gabehabe @ 31 Aug, 2008 - 09:03 AM) *

You compiled it to a com? You can't just change the extension and expect it to work.

Here, I use this: [click]

I'm gonna make my own bat2exe though, it's easy enough~

Anyway, I digress.

I'm looking over your program now, there's a lot of unnecessary stuff in it, and you actually use the random numbers wrong. The range will start from 0, not 1.

I'll fix your code, and post it here when it's done. icon_up.gif

edit:
Here. I'm not sure why you repeat the if to set the string to the same thing, I assume it's just to make it more likely for a smaller event?

Anyway, you could do it with something like this to greatly reduce your code:
IF %var% lss 5 (echo %var% is either 0,1,2,3 or 4)

Here's a little thing I threw together to try to show you how you can have multiple conditions:
CODE
@echo off
set /a var = %random% %% 10
if %var% lss 4 (echo %var% is either 0,1,2 or 3)
if %var% gtr 3 if %var% lss 8 == (echo %var% is either 4,5,6 or 7)
if %var% gtr 7 (echo %var% is either 8 or 9)
pause


Hope this helps smile.gif



Thanks again biggrin.gif.

I really like that someone helps a lot biggrin.gif i never knew it could do that thanks again also another thing about that... How do i make it go in between not greater not less then not equal to but a greater and less then like something like this (THIS IS an example in ENGLISH)


a number greater then 20 but less then 30

Simple right but i do not know how to put it in batch!?!?! lol

can you hlep me with that now...

Also the question of this topic was how to fix the application problem...

So i guess that was a little off topic... nvm
your a mod LOL
thanks for suggesting that that will help me a lot more then the other way biggrin.gif

EDIT: sorry i did not read your post alll the way so i did not see.. My question is already answered in your post LOL

EDIT AGAIN:

sorry to say but my program does not run after compileing with that program bat 2 exe plus i heard that the com rename to exe is the same exact thing because .com is a application

but .exe is the same thing its difference is really nothing exempt for its look

rolleyes.gif

well please help me figure this out then thanks also i just fixed the coding biggrin.gif

This post has been edited by coaster3000: 31 Aug, 2008 - 10:01 AM
User is offlineProfile CardPM

Go to the top of the page

gabehabe
post 31 Aug, 2008 - 09:44 AM
Post #4


Working Girl.

Group Icon
Joined: 6 Feb, 2008
Posts: 5,402



Thanked 94 times

Dream Kudos: 2625

Expert In: Dingleberries

My Contributions


QUOTE
a number greater then 20 but less then 30

Simple.

CODE
@ECHO OFF
SET /a var = 24
IF %var% GTR 20 IF %var% LSS 30 (echo greater than 20, but less than 30)
PAUSE


If you want a nice little reference on if statements, click here

Hope this helps smile.gif
User is offlineProfile CardPM

Go to the top of the page

coaster3000
post 31 Aug, 2008 - 10:03 AM
Post #5


D.I.C Head

**
Joined: 28 Aug, 2008
Posts: 79


My Contributions


QUOTE(gabehabe @ 31 Aug, 2008 - 12:44 PM) *

QUOTE
a number greater then 20 but less then 30

Simple.

CODE
@ECHO OFF
SET /a var = 24
IF %var% GTR 20 IF %var% LSS 30 (echo greater than 20, but less than 30)
PAUSE


If you want a nice little reference on if statements, click here

Hope this helps smile.gif

lol sorry but i forgot to read the rest of that post earlier LOL but the new problem is in the post above you i edited it
User is offlineProfile CardPM

Go to the top of the page

gabehabe
post 31 Aug, 2008 - 10:23 AM
Post #6


Working Girl.

Group Icon
Joined: 6 Feb, 2008
Posts: 5,402



Thanked 94 times

Dream Kudos: 2625

Expert In: Dingleberries

My Contributions


OK, I've never really bothered with .com

Anyway.

I doubt it's anything to do with your converter, it's most likely an issue with your code.

Try running the .bat, it will probably have the same output. smile.gif
User is offlineProfile CardPM

Go to the top of the page

coaster3000
post 31 Aug, 2008 - 10:43 AM
Post #7


D.I.C Head

**
Joined: 28 Aug, 2008
Posts: 79


My Contributions


QUOTE(gabehabe @ 31 Aug, 2008 - 01:23 PM) *

OK, I've never really bothered with .com

Anyway.

I doubt it's anything to do with your converter, it's most likely an issue with your code.

Try running the .bat, it will probably have the same output. smile.gif

I just ran it 10 times with ease the .bat file.......

i am playing my FULL FORCE NATURE game on vpyro.com

sorry about that link but i had to say what site i posted it on
User is offlineProfile CardPM

Go to the top of the page

gabehabe
post 31 Aug, 2008 - 11:39 AM
Post #8


Working Girl.

Group Icon
Joined: 6 Feb, 2008
Posts: 5,402



Thanked 94 times

Dream Kudos: 2625

Expert In: Dingleberries

My Contributions


What?

If anything, it's probably your converter~ Did you try the one I linked you to?
User is offlineProfile CardPM

Go to the top of the page

coaster3000
post 31 Aug, 2008 - 11:42 AM
Post #9


D.I.C Head

**
Joined: 28 Aug, 2008
Posts: 79


My Contributions


Actually that is the one i tried :-/

Well i used the com one and it worked when using the application but then when i hit enter when it says strike any key to continue the thing quits after striking one

Can you help me find out why
User is offlineProfile CardPM

Go to the top of the page

gabehabe
post 31 Aug, 2008 - 11:44 AM
Post #10


Working Girl.

Group Icon
Joined: 6 Feb, 2008
Posts: 5,402



Thanked 94 times

Dream Kudos: 2625

Expert In: Dingleberries

My Contributions


Post your code, as it is now~

I'll take a look at it, and try converting it to an exe.
User is offlineProfile CardPM

Go to the top of the page

coaster3000
post 31 Aug, 2008 - 11:53 AM
Post #11


D.I.C Head

**
Joined: 28 Aug, 2008
Posts: 79


My Contributions


QUOTE(gabehabe @ 31 Aug, 2008 - 03:44 PM) *

Post your code, as it is now~

I'll take a look at it, and try converting it to an exe.


GOTCHA posting.....
CODE
@ECHO OFF
ECHO Welcome to the random event generator V1.5
ECHO Warning this is a Beta File!
ECHO This program is now fully functional and will be very easy to use.
Pause
:LOOP
ECHO Please enter event type. . . .
SET /p type=
IF %type%==Weather GOTO Weather
IF %type%==weather GOTO Weather
IF %type%==Dissaster GOTO Dissaster
IF %type%==dissaster GOTO Dissaster

:Weather
SET /a var=%random% %% 1300
IF %var% lss 301 SET string= Nice And Sunny with little clouds
IF %var% gtr 300 IF %var% lss 351 SET string= Cold But Sunny
IF %var% gtr 350 IF %var% lss 401 SET string= Windy
IF %var% gtr 400 IF %var% lss 451 SET string= Stormy Winds
IF %var% gtr 450 IF %var% lss 501 SET string= Tornado F0
IF %var% gtr 500 IF %var% lss 551 SET string= Tornado F1
IF %var% gtr 550 IF %var% lss 600 SET string= Tornado F2
IF %var% gtr 601 IF %var% lss 650 SET string= Tornado F3
IF %var% gtr 650 IF %var% lss 700 SET string= Tornado F4
IF %var% gtr 700 IF %var% lss 750 SET string= Tornado F5
IF %var%==751 SET string= Tornado F6!!!!!!!
IF %var% gtr 751 IF %var% lss 800 SET string= Hurricane C1
IF %var% gtr 800 IF %var% lss 850 SET string= Hurricane C2
IF %var% gtr 850 IF %var% lss 900 SET string= Hurricane C3
IF %var% gtr 900 IF %var% lss 950 SET string= Hurricane C4
IF %var% gtr 950 IF %var% lss 1000 SET string= Severe T Storm with Hail
IF %var% gtr 1000 IF %var% lss 1100 SET string= T Storm
IF %var% gtr 1100 IF %var% lss 1150 SET string= Severe T Storm with strong winds and hail
IF %var% gtr 1150 IF %var% lss 1200 SET string= Heavy Rain
IF %var% gtr 1200 IF %var% lss 1300 SET string= Rain
ECHO %string%
GOTO Retry
:Dissaster
SET /a var=%random% %% 51
IF %var% lss 26 SET string=Nothing
IF %var% gtr 25 IF %var% lss 31 SET string=Earthquake
IF %var% gtr 30 IF %var% lss 36 SET string=Plague
IF %var% gtr 35 IF %var% lss 41 SET string=Flash flooding
IF %var% gtr 40 IF %var% lss 51 SET string=Drought
ECHO %string%
GOTO Retry
:Retry
ECHO Want to retry??? Y OR N
SET /p yn=
IF %yn%==y GOTO LOOP
IF %yn%==n GOTO END
:END
User is offlineProfile CardPM

Go to the top of the page

gabehabe
post 31 Aug, 2008 - 12:17 PM
Post #12


Working Girl.

Group Icon
Joined: 6 Feb, 2008
Posts: 5,402



Thanked 94 times

Dream Kudos: 2625

Expert In: Dingleberries

My Contributions


It works 100% fine for me...
Here it is:
Attached File  Batch.zip ( 7.43k ) Number of downloads: 9


There's not much else I can do to be honest, it works fine for me unsure.gif
User is offlineProfile CardPM

Go to the top of the page

2 Pages V  1 2 >
Closed TopicStart new topic
Time is now: 11/22/08 06:43AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month