Re: Problem with subprocess.call and windows schtasks

Discussion in 'Python' started by Tim Golden, Nov 18, 2012.

  1. Tim Golden

    Tim Golden Guest

    On 18/11/2012 13:48, Tom Borkin wrote:
    > import subprocess
    > #subprocess.call(['SchTasks /Create /SC ONCE /TN "My Tasks" /TR "C:/Program
    > Files/Apache Group/Apache2/htdocs/ccc/run_alert.py" /ST 07:50'], shell=True)
    > subprocess.call(['SchTasks /Create /SC ONCE /TN "test" /TR "run_alert.py"
    > /ST 07:50'], shell=True)
    > With either call, I get this error:
    > C:\Program Files\Apache Group\Apache2\htdocs\ccc>cron_alert_activity.py
    > The system cannot find the path specified.


    Generally, with subprocess call:

    * Pass each element in the command line as a separate element in the
    list: ['SchTasks', '/Create', '/SC', 'ONCE', ... &c.]

    * Don't use shell=True unless you're running a command which is internal
    to cmd.exe (such as dir, copy, etc.). If you're running anything which
    exists as its own .exe, you shouldn't be using shell=True.

    TJG
    Tim Golden, Nov 18, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. cct

    schtasks problem

    cct, Nov 12, 2003, in forum: ASP .Net Security
    Replies:
    0
    Views:
    160
  2. Chris Rebert
    Replies:
    0
    Views:
    201
    Chris Rebert
    Nov 18, 2012
  3. Dave Angel
    Replies:
    0
    Views:
    159
    Dave Angel
    Nov 21, 2012
  4. Tim Golden
    Replies:
    0
    Views:
    122
    Tim Golden
    Nov 21, 2012
  5. Prasad, Ramit
    Replies:
    0
    Views:
    150
    Prasad, Ramit
    Nov 23, 2012
Loading...

Share This Page