Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 08-30-2004, 04:34 AM   #1
Member (4 bit)
 
Join Date: Oct 2002
Posts: 10
simple batch file

Hi, this is I hope a very simple question.

I want to make a batch file on my desktop to run a program (with parameters) and then shutdown my computer. I have already created a shortcut on my desktop to run the program as I want it. The target of the shortcut is:

"C:\Program Files\2BrightSparks\SyncBack\SyncBack.exe" "Email messages"

Double clicking on this shortcut runs the program as I want it to, so I know that I'm calling the program with the correct syntax. As a second check I entered this exact same line into a command line prompt, and again it runs fine.

Now, I want to use a batch file so that I can enter another line below it to shut down the machine when the task is done. To start with I just tried to get the batch file to run the task, forgetting about the shutdown bit, so I entered the exact same line into a batch file (with nothing else in the file) and saved it on my desktop with a .bat suffix. But when I double click on this batch file my program doesn't run All I get is a dos window opening and then closing straight away before I can read what it says in the window.

I'm running XP home SP2.

Any ideas much appreciated,

Justin
justins is offline   Reply With Quote
Old 08-30-2004, 04:45 AM   #2
RJ
Member (14 bit)
 
Join Date: Feb 2000
Location: Offenbach/Main (Germany)
Posts: 8,485
Send a message via ICQ to RJ
Try this line, it should work:

shutdown -s -t 0

RJ
__________________
All's right with the world when your PC is working right.
RJ is offline   Reply With Quote
Old 08-30-2004, 08:44 AM   #3
Member (4 bit)
 
Join Date: Oct 2002
Posts: 10
No, same problem. I can't even shutdown my machine with a batch file. When I run a file with that line in (shutdown -s -t 0) I just get the same thing - DOS window opens and then closes before I can read it. Anybody know how I can stop this dos window from closing automatically so that I can read any error messages?
justins is offline   Reply With Quote
Old 08-30-2004, 08:57 AM   #4
Member (7 bit)
 
shaticus's Avatar
 
Join Date: May 2004
Posts: 103
just put "pause" (minus the quotes) on a seperate line after the first command but before the shutdown command

Last edited by shaticus; 08-30-2004 at 09:02 AM.
shaticus is offline   Reply With Quote
Old 08-30-2004, 09:19 AM   #5
Member (4 bit)
 
Join Date: Oct 2002
Posts: 10
I REALLY can't do ANYTHING from a batch file. Please look at my first post - I can't even run the original program, let alone shut the machine down afterwards. I'm confident that it's not a problem with my syntax as (like I said in my first post) I can run theses commands from a command line prompt fine, but NOTHING works from a batch file
justins is offline   Reply With Quote
Old 08-30-2004, 11:19 AM   #6
Barefoot on the Moon!
Staff
Premium Member
 
Force Flow's Avatar
 
Join Date: Aug 2002
Location: Northeastern USA
Posts: 13,385
Try this. Open up notepad, paste the following code in notepad, and save it as a *.bat file.
Code:
@echo off
start /d"C:\Program Files\2BrightSparks\SyncBack\" SyncBack.exe
pause
Take a look here for a shutdown: http://personal-computer-tutor.com/abc3/v24/vic24.htm
__________________
There are two secrets to staying young, being happy, and achieving success. You have to laugh and find humor every day, and you have to have a dream.
Force Flow is offline   Reply With Quote
Old 08-30-2004, 12:40 PM   #7
Member (4 bit)
 
Join Date: Oct 2002
Posts: 10
problem solved

I worked this one out...

I was saving the .bat file as "unencode text document" instead of "text document"...silly me... Thanks for all the help anyway...l
justins is offline   Reply With Quote
Old 08-30-2004, 01:17 PM   #8
Member (11 bit)
 
Doobie's Avatar
 
Join Date: Jul 2002
Location: Mexico
Posts: 1,049
Send a message via AIM to Doobie Send a message via Yahoo to Doobie
Quote:
Originally Posted by justins
I worked this one out...

I was saving the .bat file as "unencode text document" instead of "text document"...silly me... Thanks for all the help anyway...l
you might want to use
start /wait

so the computer will shut down when your program has ended instead of the .bat running shutdown command after starting your program.
__________________
Computer: 486
Ram: 8 MB
CD Rom: None
OS: Windows 3.1
Doobie is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 06:52 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2