Run .exe job with parameter in scheduled job

  • I want to run an .exe in a SQL Server 2000 scheduled job that needs a parameter passed to it.  I have set up the job by using CMDEXEC

    Command:

    C:\purge.exe 7

    This runs but does not pass the 7 to the job so the job never ends until I manually cancel it.  The jobs runs fine from a command line. 

    I would appreciate any help that could be sent my way.

     

  • i think if you use xp_cmdshell 'C:\purge.exe 7' it will work; I know I call executables with command line arguments like this all the tiem.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • I tried xp_cmdshell 'C:\purge.exe 7' but it failed immediately

    reason: The system cannot find the file specified 

    It will try to run if the 7 is not there, but I need to pass the 7 to the job.

  • just a bit of clarification:

    the program Purge.exe exists on the SQl server itself, right? not locally?

    here's a typical example of what i might do: i put file contents in a text file, that i later read in another process

     

    exec xp_cmdshell 'dir c:\*.* > c:\contents.log'

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply