LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2010, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 19 Dec 2010 17:19:15 -0500
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 command and paths containing blanks

Your filenames have embedded spaces in them. So for Windows (DOS) to determine what part of your command string is the command and what part are the parameters you need to enclose your file references in quotes.

To generate a double quote (") inside of string quoted with double quotes you just have to use two double quote characters. Same works with single quote (').

So this command: X """C:\dir 1\program"" ""parameter one"" ""parameter two"""; Will send this command to DOS: "C:\dir 1\program" "parameter one" "parameter two"

The QUOTE function is a useful way to deal with this:

%let command=C:\temp\Test Programs\test_xcopy.bat x %sysfunc(quote( %sysfunc(quote(&command)) %sysfunc(quote(&param1)) %sysfunc(quote(&param2)) ));

You could also just rename your directories to not have embedded spaces in them and then DOS will not need the extra quotes.

- Tom

On Sun, 19 Dec 2010 10:49:58 -0500, Sune Christiansen <sune@LUNDBECK.COM> wrote:

>Hi again > >After a considerable number of try-and-error I found that the following >works (maybe not the most pretty code): > >The SAS code: >%let param1=C:\temp\Test Programs\Input\Test_Copy.txt; >%let param2=C:\temp\Test Programs\Output\; > >options xwait; > >X " %str(%" %"C:\temp\Test Programs\test_xcopy.bat%" %"C:\temp\Test >Programs\Input\Test_Copy.txt%" %"C:\temp\Test Programs\Output\%" %") "; > >The .bat file: >xcopy %1 %2 > >Thanks for the suggestions, >Sune


Back to: Top of message | Previous page | Main SAS-L page