run exe by passing 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.  The job purges data from the database and will purge 7 months of information.  1 -12 could be passed in this parameter.

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

    This is a followup to my previous posting and I am requesting additionial information.

  • Have you tried putting the exe into an execute process task in a DTS package and then scheduling the DTS package?  The task is designed to take parameters for executables.


  • No, I have not tried executing in a DTS Package.  I was trying to execute in a multi step scheduled job so that I could run a string of month end jobs one after the other.  Thanks for your suggestion.  I am not up on DTS packages but I may try it if no one else has another suggestion.

  • The other option is to put the comand line with argument in a batch file and run the batch file from the scheduler.  If your month end jobs are all executables you could put them all in the batch file so they are maintained in one place at least.

    the file monthendjobs.bat would look like this:

    @start /wait c:\purge.exe 7

    @start /wait c:\path2jobfile\job2.exe param

    and so forth


  • The following works for me -

    EXECUTE master..xp_cmdshell '\\asm18\sys\appsdata\rentro~1\genera~1\mnprm.exe "ALL" "ALL" "9999"', no_output

    The EXE above receives 3 parameters...

    ~Steve

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

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