我正在尝试使用Powershell来使用cli编译器/链接器自动化项目的构建。我想将脚本放在项目的根目录下,并让它检查所有源文件递归并编译它们,编译器输出指向与源文件相同的目录。我还想收集* .c作为逗号分隔变量的列表作为链接器的输入。这是典型的情况:如何检索具有Powershell的递归目录名称?
//projects/build_script.ps
//projects/proj_a/ (contains a bunch of source files)
//projects/proj_b/ (contains a bunch of source files)
我希望扫描所有子目录并编译每个* .c文件的源代码。这是我到目前为止有:
$compilerLocation = "C:\Program Files (x86)\HI-TECH Software\PICC-18\PRO\9.63\bin\picc18.exe";
$args = "--runtime=default,+clear,+init,-keep";
$Dir = get-childitem C:\projects -recurse
$List = $Dir | where {$_.extension -eq ".c"}
$List | $compilerLocation + "-pass" + $_ + $args + "-output=" + $_.current-directory;
我意识到,$ _当前目录是不是一个真正的人,我可能有其他问题的语法。对于我的问题含糊不清,我很抱歉,我更愿意进一步解释可能看起来不清楚的东西。
你正在写的PostScript构建脚本? Hardcore ... ;-) – Joey 2011-03-31 07:49:12