|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#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 |
|
|
|
|
|
#2 |
|
Member (14 bit)
|
Try this line, it should work:
shutdown -s -t 0 RJ
__________________
All's right with the world when your PC is working right.
|
|
|
|
|
|
#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?
|
|
|
|
|
|
#4 |
|
Member (7 bit)
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. |
|
|
|
|
|
#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
|
|
|
|
|
|
#6 |
|
Barefoot on the Moon!
Staff
Premium Member
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
__________________
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.
|
|
|
|
|
|
#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
|
|
|
|
|
|
#8 | |
|
Member (11 bit)
|
Quote:
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 |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|