title: Oracle dbms_scheduler for remote agent mangling parameter with double-quotes
body: <p>I have a dbms_scheduler job running across to a remote scheduler agent to run a powershell script. The problem is that one of the values I am passing is a double-quoted path, and Oracle is mangling it when it tries to put it on the command line:</p>
  
  <p>My job call:</p>
  
  <pre><code>BEGIN
    -- Windows executable job type
    DBMS_SCHEDULER.create_job(
      job_name             =&gt; 'test_dstage_job',
      job_type             =&gt; 'EXECUTABLE',
      number_of_arguments  =&gt; 6,
      job_action           =&gt; 'C:\windows\system32\cmd.exe',
      auto_drop            =&gt; TRUE,
      enabled              =&gt; FALSE);
  -- this is a required first parameter to the cmd.exe call
    DBMS_SCHEDULER.set_job_argument_value('test_dstage_job',1,'/c');
  -- second parameter is the batch file to run
    DBMS_SCHEDULER.set_job_argument_value('test_dstage_job',2,'Powershell');
  -- a bogus third parameter value to be passed to the batch file that we want to see echoed in the log
    DBMS_SCHEDULER.set_job_argument_value('test_dstage_job',3,'-file'); 
    DBMS_SCHEDULER.set_job_argument_value('test_dstage_job',4,'"D:\IIS Project Files\JOBMGMTSYS_DEV\run_dsjob.ps1"');
    DBMS_SCHEDULER.set_job_argument_value('test_dstage_job',5,'-input_values');
    DBMS_SCHEDULER.set_job_argument_value('test_dstage_job',6,'dsProject=RDM;dsEnvironment=DEV;dsJob=s_Main_RDM_WF;wrkflwRunSid=10;pmCD_TBL_LST=ADR_USG,AGE_VRFCTN_DOC_TYP,BUY_SELL_AGRMT_TYP,CLNT_IMPTNC;pmAPLTN_RGSTRY_CD=RDM;RDM_PARAMETERS_SysEnv=PARM_FILE_SYS');
  ---- set the credential to use
    DBMS_SCHEDULER.set_attribute('test_dstage_job', 'credential_name', 'PREPROD_CREDENTIAL');
  -- and the destination
  -- can also set destination by the DESTINATION_NAME, or the IP:PORT combo. I’ve tried all three flavours, 
    DBMS_SCHEDULER.set_attribute('test_dstage_job', 'destination', 'ppr235qapp47.pre-prod.prv:8090');
  -- and now launch it.
    DBMS_SCHEDULER.enable('test_dstage_job');
  END;
  </code></pre>
  
  <p>But according to the log on the Windows box, parameter 4, the file argument, gets passed to the command line as</p>
  
  <pre><code>C:\windows\system32\cmd.exe /c Powershell -file  "\"D:\IIS Project Files\JOBMGMTSYS_DEV\run_dsjob.ps1\"" -input_values dsProject=RDM;dsEnvironment=DEV;dsJob=s_Main_RDM_WF;wrkflwRunSid=10;pmCD_TBL_LST=ADR_USG,AGE_VRFCTN_DOC_TYP,BUY_SELL_AGRMT_TYP,CLNT_IMPTNC;pmAPLTN_RGSTRY_CD=RDM
  </code></pre>
  
  <p>So it is changing:</p>
  
  <blockquote>
    <p>"D:\IIS Project Files\JOBMGMTSYS_DEV\run_dsjob.ps1"</p>
  </blockquote>
  
  <p>To </p>
  
  <blockquote>
    <p>"\"D:\IIS Project Files\JOBMGMTSYS_DEV\run_dsjob.ps1""</p>
  </blockquote>
  
  <p>Adding an extra double-quote backslash to the front, and an extra double-quote to the end.</p>
  
  <p>Any ideas?</p>