Quoting directory path in filename catd pipe 'dir "c:\test" /a-d /b /s';

Accepted Solution Solved
Reply
Contributor
Posts: 65
Accepted Solution

Quoting directory path in filename catd pipe 'dir "c:\test" /a-d /b /s';

Quoting the directory path in below statement, when its supplied as a macro variable,

path in

%let logdir = c:\test;

%let filot = %str(%'dir %")&logdir%%str(%" /a-d /b /s%');

%put &filot;

filename catd pipe &filot ;

filename catd pipe %nrstr(&filot);

'%put' resolves &filot to the exact value in filename statement, but none other statements gets resolved.

D Moovendhan


Accepted Solutions
Solution
‎02-07-2013 03:31 PM
Super User
Super User
Posts: 7,079

Re: Quoting directory path in filename catd pipe 'dir "c:\test" /a-d /b /s';

Posted in reply to DMoovendhan

%let logdir = c:\test;

%let command = dir "&logdir" /a-d /b /s ;

%put &command;

filename catd pipe %sysfunc(quote(&command));

View solution in original post


All Replies
Super Contributor
Posts: 578

Re: Quoting directory path in filename catd pipe 'dir "c:\test" /a-d /b /s';

Posted in reply to DMoovendhan

try this:


filename catd pipe "&filot" ;

Contributor
Posts: 65

Re: Quoting directory path in filename catd pipe 'dir "c:\test" /a-d /b /s';

Thank you Bailey, I have tried this, but it doesn't work...

Solution
‎02-07-2013 03:31 PM
Super User
Super User
Posts: 7,079

Re: Quoting directory path in filename catd pipe 'dir "c:\test" /a-d /b /s';

Posted in reply to DMoovendhan

%let logdir = c:\test;

%let command = dir "&logdir" /a-d /b /s ;

%put &command;

filename catd pipe %sysfunc(quote(&command));

Contributor
Posts: 65

Re: Quoting directory path in filename catd pipe 'dir "c:\test" /a-d /b /s';

Thank you Tom this was more helpful.. Now I know new function quote.. Smiley Happy

Super User
Super User
Posts: 7,079

Re: Quoting directory path in filename catd pipe 'dir "c:\test" /a-d /b /s';

Posted in reply to DMoovendhan

You can also just double the internal quotes yourself.

filename catd pipe "dir ""&logdir"" /a-d /b /s ";

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 255 views
  • 5 likes
  • 3 in conversation