-
January 12th, 2004, 07:28 PM
#1
Member
Batch File Command?
Ok, I'm sort of new to the world of Batch File creation. I'm trying to create a batch file that will close down a program, and then another batch file that will re-open the program...
Basically here's why - I have a program that needs to run on our server in order for others to be able to access the programs from their workstations. Each night I run a backup of the server's critical files including the database for this program. The only problem is, when this program is running on the server - it won't back up the database. All users shut down at the end of the night - so I know they won't be accessing it, but they usually work much later than do I and I don't want to have to show them how to shut off the program in the server each night before they leave...
So I'm looking for a bat file command that I can run that I can add to the scheduler to close the program - then have the backup set to run after that time - the backup takes about 40 minutes - so then I would have another batch file that, maybe say an hour later, would re-open the program...
I found a batch file that will open a program (the start command0 with a good explanation of how this will work) but none for shutting down.
I actually found two sites that had a URL link that said something about 'A way to shut down a program from within a batch file' but the link was a bad one - so I have to think there might be a way to figure this out.
-
January 12th, 2004, 07:47 PM
#2
If your database is running as a service, look into the Net stop - Net Start commands.
Net stop database
40 to 60 minutes later:
Net start database
Simple, but they should do the trick for you.
Cheers:
-
January 12th, 2004, 07:50 PM
#3
Member
unfortunately - it is not running as a service - just as a program with database like mappings - its a very strange program...
it shows up in the task manager - but it is not listed as a service.
-
January 12th, 2004, 07:57 PM
#4
Can't you just use the 'start' and 'close' commands along w/ the name of the .exe file?
Every now and then, one of you won't annoy me.
-
January 12th, 2004, 08:08 PM
#5
Member
close command
The close command is not recognized as an internal or external command, operable program, or batch command...
-
January 12th, 2004, 08:14 PM
#6
Eh, I was just guessing since you never did tell us what OS the workstations are using, it does make a difference ya know. . . so what OS?
Every now and then, one of you won't annoy me.
-
January 12th, 2004, 08:18 PM
#7
Member
These are on Windows 2k Servers - and one windows 2k advanced server - but mainly windows 2k server.
-
January 12th, 2004, 08:21 PM
#8
If you know or can discover the process name, check out PSKILL from Sysinternals
Cheers:
-
January 12th, 2004, 08:41 PM
#9
Member
Awesome
Awesome - that'll work...thanks so much.
-
January 12th, 2004, 08:43 PM
#10
Yeah, I'd go that route too, can't find anything either for Win2K. You could always use Perl though. :P
Every now and then, one of you won't annoy me.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|