Basic Question

MC

New Member
💻 Oldtimer
Joined
May 24, 2003
Messages
3,989
Best answers
0
I have had this problem for a while and I have found no way to fix it.

When I try to run a Command Prompt command the Command Prompt only stays open for a second and then it closes completely. Such as I make a program and try to run the executable by double clicking the .exe file

I have tried to execute the program through the Command Prompt though the same problem occured.
 
New Member
💻 Oldtimer
Joined
Sep 8, 2002
Messages
2,278
Best answers
0
What command are you trying to run?

You could always make a .txt file and rename it to a .bat file, open it up (with NOTEPAD) and type the desired commands and add another line that says PAUSE. Then run the .bat file and see what happend.
 

MC

New Member
💻 Oldtimer
Joined
May 24, 2003
Messages
3,989
Best answers
0
Well it really is not much of a command. When I make a program in PASCAL and try to run it, the command prompt pops up for a second then closes. I have also noticed the same occurance whenever I try to open up something that opens up the command prompt.
 
New Member
💻 Oldtimer
Joined
Sep 8, 2002
Messages
2,278
Best answers
0
Heh Pascal. Anyways, try the method I told you to use, it might help you figure out the problem.
 
New Member
Joined
Dec 10, 2003
Messages
117
Best answers
0
Well I did have a related problem when I was programming in C. When I used to write simple programs I had to put a
Code:
system("PAUSE");
at the end of the code so that after the program ran and was completed it would wait for the user to press a key before closing the console window. I dont know Pascal but maybe there is something simliar to add to the end of your code that would tell the program to wait for a user input before closing?
 

MC

New Member
💻 Oldtimer
Joined
May 24, 2003
Messages
3,989
Best answers
0
Dewd In Ћe Newd said:
What command are you trying to run?

You could always make a .txt file and rename it to a .bat file, open it up (with NOTEPAD) and type the desired commands and add another line that says PAUSE. Then run the .bat file and see what happend.
Does not work. I took the .txt file I used to plan the program and changed it to a .bat. I opened it up in notepad and added PAUSE at the end of my program. It did stop it from closing though the program I wrote did not function properly at all.

madgik said:
Well I did have a related problem when I was programming in C. When I used to write simple programs I had to put a
Code:
system("PAUSE");
at the end of the code so that after the program ran and was completed it would wait for the user to press a key before closing the console window. I dont know Pascal but maybe there is something simliar to add to the end of your code that would tell the program to wait for a user input before closing?
Unfortunately I would not know a PASCAL command that would be similar to C.
 
New Member
Joined
Dec 10, 2003
Messages
117
Best answers
0
I did a bit of googling and found that if you add
Code:
ReadLn;
at the end of your program code, before the
Code:
end.
command you should get the system to pause until the user presses the "Enter" key.

Hope that helps
 

MC

New Member
💻 Oldtimer
Joined
May 24, 2003
Messages
3,989
Best answers
0
madgik said:
I did a bit of googling and found that if you add
Code:
ReadLn;
at the end of your program code, before the
Code:
end.
command you should get the system to pause until the user presses the "Enter" key.

Hope that helps
I forgot about the readln code... lol.

Alright, it fixed my problem, thanks a lot for the help.

A moderator can close this.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top