Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4116680
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:44:19+00:00 2026-05-20T22:44:19+00:00

I am attempting to use Powershell to automate the builds of projects using a

  • 0

I am attempting to use Powershell to automate the builds of projects using a cli compiler/linker. I want to place the script in the root directory of a project and have it check for all source files recursively and compile them, with the compiler output pointed at the same directory as the source files. I would also like to collect a list of the *.c as a comma-delimited variable as input to the linker. This is the typical situation:

//projects/build_script.ps
//projects/proj_a/ (contains a bunch of source files)
//projects/proj_b/ (contains a bunch of source files)

I wish to scan all the sub directories and compile the source for each *.c file. This is what I have so far:

$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;

I realize that $_.current-directory isn’t a real member, and I likely have other problems with the syntax. I apologize for the vagueness of my question, I am more than willing to further explain what may seem unclear.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T22:44:20+00:00Added an answer on May 20, 2026 at 10:44 pm

    Forgive me if I don’t understand your exact requirement. Below is an example of recursively getting all files with the .txt extension, and then listing the file’s name and the containing directory’s name. To get this I access the DirectoryName property value on the FileInfo object. See FileInfo documentation for more information.

    $x = Get-ChildItem . -Recurse -Include "*.txt"
    $x | ForEach-Object {Write-Host "FileName: $($_.Name) `nDirectory: $($_.DirectoryName)"}
    

    To take a stab at your current code:

    $compilerLocation = "C:\Program Files (x86)\HI-TECH Software\PICC-18\PRO\9.63\bin\picc18.exe";
    $args = "--runtime=default,+clear,+init,-keep";
    $List = Get-ChildItem C:\project -Recurse -Include *.c
    $List | ForEach-Object{#Call your commands for each fileinfo object}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to write a Twitter Powershell script that will use community created interfaces
When working with NuGet, I'm attempting to use a powershell script to change a
I am attempting to use FTP in Powershell to upload a file. I am
I am attempting to use the following code to search a database using words
I am attempting to use background-image:url('path/to/image.png'); to place a background image in a div
I'm attempting to use C# as a scripting language using CSharpCodeProvider (using VS2010 and
I'm currently attempting to use HighStock charts on my site. I'll be using a
Attempting to use the data series from this example no longer passes the JSONLint
Attempting to use XStream's JavaBeanConverter and running into an issue. Most likely I'm missng
When attempting to use HttpWebRequest to retrieve a page from my dev server, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.