首页 > 编程知识 正文

c语言mod函数头文件,c语言与c十十的区别

时间:2023-05-03 18:06:14 阅读:155803 作者:3169

c35; 的“dir”(也称为“获取字符”) powershell cmdlet。

不是你是否应该。 )

必须将此引用添加到项目文件中(

. csproj "或"

. vcproj“”手动:

这里有作业步骤:

使用系统;

using system.collections.generic;

using system.management.automation;

using system.management.automation.run spaces;

using system.collections.object model;

namespace CsWildcard {

类程序{

staticienumerablecmdletdirglobbing (string basepath,string glob ) {

runspace.Open (;

//cd to basePath

基本路径!=null ) {

pipelinecdpipeline=run space.create pipeline (;

commandCDcommand=newcommand(CD );

CDcommand.parameters.add('path ',basePath );

CD pipeline.commands.add (CD command;

cdPipeline.Invoke (; //run the cmdlet

}

//runthe ' dir ' cmdlet (e.g.' dirc : (* (*.txt ) ) )

pipelinedirpipeline=run space.create pipeline (;

commanddircommand=new command (dir );

dir command.parameters.add (' path ',glob );

dir pipeline.commands.add (dir command;

collectiondiroutput=dir pipeline.invoke (;

//for each found file

foreach { psobjectpsobjectindiroutput }

//lookforthefullpath('fullname ) )。

foreach (pspropertyinfopspropertyinfoinpsobject.properties ) {

pspropertyinfo.name==' full name ' ) }

yeldreturnpspropertyinfo.value.tostring (; //yield it

}

}

}

}

staticvoidmain (字符串野性之缘args ) )。

foreach (stringpathincmdletdirglobbing (null,' c: ) ((((() () (*.txt ) ) ) ) }

system.console.writeline(path );

}

foreach (stringpathincmdletdirglobbing (c : (,)、((((((() ).exe ) ) )

system.console.writeline(path );

}

Console.ReadKey (;

}

}

}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。