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

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




Scripting on windows

 
Reply to this topicStart new topic

Scripting on windows, PAUSE

chris.tkd
19 Dec, 2007 - 07:04 AM
Post #1

D.I.C Head
Group Icon

Joined: 26 Sep, 2006
Posts: 60


Dream Kudos: 25
My Contributions
Hello, i am making a simple script on windows xp and need to be able to read the success / error message. The problem is that it closes too fast. I have tryed using the PAUSE command to halt the program at completion but still no luck, an example is

CODE

cd C:\work
CALL dowork.bat
PAUSE


Can anyone explain why the PAUSE statement is not stopping the program until i press a key?

Thanks,
Chris.
User is offlineProfile CardPM
+Quote Post

no2pencil
RE: Scripting On Windows
19 Dec, 2007 - 07:18 AM
Post #2

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 6,443



Thanked: 66 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
QUOTE(chris.tkd @ 19 Dec, 2007 - 08:04 AM) *

Hello, i am making a simple script on windows xp and need to be able to read the success / error message. The problem is that it closes too fast. I have tryed using the PAUSE command to halt the program at completion but still no luck, an example is

CODE

cd C:\work
CALL dowork.bat
PAUSE


Can anyone explain why the PAUSE statement is not stopping the program until i press a key?

Thanks,
Chris.

1.) Why don't you put the pause inside of your batch file?
2.) Are you typing the command, then typing pause?
3.) why not call C:\work\dowork.bat?
User is online!Profile CardPM
+Quote Post

chris.tkd
RE: Scripting On Windows
20 Dec, 2007 - 01:04 AM
Post #3

D.I.C Head
Group Icon

Joined: 26 Sep, 2006
Posts: 60


Dream Kudos: 25
My Contributions
Well, that was just a simple example where the dowork.bat and cd to c:/work represnts doing stuff, it isnt in the actual .bat file i want to PAUSE.
User is offlineProfile CardPM
+Quote Post

ericode
RE: Scripting On Windows
21 Dec, 2007 - 06:49 PM
Post #4

D.I.C Head
Group Icon

Joined: 9 Dec, 2006
Posts: 89


Dream Kudos: 75
My Contributions
QUOTE(chris.tkd @ 20 Dec, 2007 - 02:04 AM) *

Well, that was just a simple example where the dowork.bat and cd to c:/work represnts doing stuff, it isnt in the actual .bat file i want to PAUSE.


So you are saying that in a .bat file you have created, at the end of its work you have a PAUSE statement, and the .bat file runs and closes before you can see the output? If that is so, I am baffled. Please tell me that is not so.
User is offlineProfile CardPM
+Quote Post

no2pencil
RE: Scripting On Windows
21 Dec, 2007 - 06:51 PM
Post #5

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 6,443



Thanked: 66 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
QUOTE(ericode @ 21 Dec, 2007 - 07:49 PM) *

QUOTE(chris.tkd @ 20 Dec, 2007 - 02:04 AM) *

Well, that was just a simple example where the dowork.bat and cd to c:/work represnts doing stuff, it isnt in the actual .bat file i want to PAUSE.


So you are saying that in a .bat file you have created, at the end of its work you have a PAUSE statement, and the .bat file runs and closes before you can see the output? If that is so, I am baffled. Please tell me that is not so.

I suppose it's possible that if you are getting an error in your script prior to the pause command, the script is closing. Are you running this FROM the command prompt, or by double clicking on it?

Is it possible to post your code?
User is online!Profile CardPM
+Quote Post

lockdown
RE: Scripting On Windows
27 Dec, 2007 - 07:32 AM
Post #6

D.I.C Regular
Group Icon

Joined: 29 Sep, 2007
Posts: 376



Thanked: 1 times
Expert In: PC, Support

My Contributions
You need to have a PAUSE command in your dowork.bat for it to pause the application. You do not need it to be included in the batch file that calls to dowork.bat.

Also you do not need to do the CD (Change Directory) command and also you do not need the Call command in your code.
CODE

C:\work\dowork.bat

That code above will call the dowork.bat file. In your dowork.bat you need to put PAUSE as the last line and that will solve your issue.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 11:28PM

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