Batch File Command?
Results 1 to 10 of 10

Thread: Batch File Command?

  1. #1
    Member
    Join Date
    Jul 2002
    Posts
    50

    Lightbulb 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.

  2. #2
    I'd rather be fishing DjM's Avatar
    Join Date
    Aug 2001
    Location
    The Great White North
    Posts
    1,867
    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:
    DjM

  3. #3
    Member
    Join Date
    Jul 2002
    Posts
    50
    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.

  4. #4
    Senior Member
    Join Date
    Jul 2002
    Posts
    744
    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.

  5. #5
    Member
    Join Date
    Jul 2002
    Posts
    50

    close command

    The close command is not recognized as an internal or external command, operable program, or batch command...

  6. #6
    Senior Member
    Join Date
    Jul 2002
    Posts
    744
    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.

  7. #7
    Member
    Join Date
    Jul 2002
    Posts
    50
    These are on Windows 2k Servers - and one windows 2k advanced server - but mainly windows 2k server.

  8. #8
    I'd rather be fishing DjM's Avatar
    Join Date
    Aug 2001
    Location
    The Great White North
    Posts
    1,867
    If you know or can discover the process name, check out PSKILL from Sysinternals

    Cheers:
    DjM

  9. #9
    Member
    Join Date
    Jul 2002
    Posts
    50

    Awesome

    Awesome - that'll work...thanks so much.

  10. #10
    Senior Member
    Join Date
    Jul 2002
    Posts
    744
    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
  •