Date: Wed, 25 Aug 2010 21:46:19 -0400
Reply-To: Tom Abernathy <tom.abernathy@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Tom Abernathy <tom.abernathy@GMAIL.COM>
Subject: Re: X commands
Brad -
Why do you need the CD command?
Why would you want to write a CSV file into the operating system
directory?
One easy way to debug this type of thing is to use a PIPE so you can see
what errors the operating system is throwing at you.
filename schtasks pipe
'c:\windows\system32\schtasks /query /FO CSV /V >tasks.csv';
data _null_;
infile schtasks;
input;
list;
run;
You might want to remove the >tasks.csv from the command and instead just
use the piped filename to read the CSV output directly into a SAS data step
and save a SAS dataset instead of a CSV file. You could even use a FILE
statement in your data step to right a copy of the output from the schtasks
command to a file.
- Tom
On Wed, 25 Aug 2010 18:45:11 -0400, Brad Jennings
<brad.jennings@ARDENTHEALTH.COM> wrote:
>I'm trying to execute a DOS command.
>
>SAS 9.2
>Windows Server 2008
>
>Commands I want to enter:
>cd c:\windows\system32\
>schtasks /query /FO CSV /V >tasks.csv
>(This should create a .csv file with all the scheduled tasks in it).
>
>This works if I do it manually.
>
>What I've tried:
>
>data _null_;
>options noxwait xsync;
>x 'cd c:\windows\system32\';
>x=sleep(2);
>x "schtasks /query /FO CSV /V >tasks.csv";
>run;
>
>It's not working.
>
>Any help would be greatly appreciated.