[英]Wildcard * in a Windows Batch Script
I would like to use the * wildcard to list all the sas program files in my Windows directory. 我想使用*通配符列出Windows目录中的所有sas程序文件。 Thus I issue the command dir *.sas But when I do this the command will also list all sas datasets as well as catalogs because they have extensions .sas7bdat and .sas7bcat respectively.
因此,我发出命令dir * .sas,但是当我这样做时,该命令还将列出所有sas数据集和目录,因为它们分别具有扩展名.sas7bdat和.sas7bcat。 How do I restrict the dir command to only list the sas program files?
如何限制dir命令仅列出sas程序文件? Thanks.
谢谢。
There is a similar quesiton here. 这里有一个类似的问题。 https://superuser.com/questions/825615/windows-wildcards-with-files-having-more-than-3-characters-extensions
https://superuser.com/questions/825615/windows-wildcards-with-files-having-more-than-3-characters-extensions
The answer from that thread is that you cannot change the behavior. 该线程的答案是您无法更改行为。 There were two proposed solutions:
提出了两种解决方案:
If you are doing it in SAS then you might use a program like this: 如果在SAS中执行此操作,则可以使用如下程序:
data want ;
infile 'dir /b *.sas' pipe truncover ;
input filename $200. ;
if lowcase(scan(filename,-1,'.'))='sas' ;
run;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.