Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to make a basic powershell command work, but I'm having some difficulty with the piping system.

I'm using Fossil for my version control system, and have made the majority of my programs structure. Running the command:

get-childitem -r | fossil add {$_.fullname}

Gives me the error

not found: E:/workspace/project/-encodedCommand
not found: E:/workspace/project/JABfAC4AZgB1AGwAbABuAGEAbQBlAA==
not found: E:/workspace/project/-inputFormat
not found: E:/workspace/project/xml
not found: E:/workspace/project/-outputFormat
not found: E:/workspace/project/text
share|improve this question

1 Answer 1

up vote 2 down vote accepted

Assuming fossil is a command used with your version control system, based on skimming through the users guide.

You will need to pass each $_.FullName into the fossil command one at a time in order for it to successfully process the file for you. You would do this using the foreach command. So it would look like:


Get-ChildItem -Recurse | foreach {fossil add $_.FullName}

You need to think in terms that each time you add the | it is passing all of the object properties to the next process or command. In your instance $_.FullName is the specific object you want to work with in the next segment. Calling the command for your version control system it has to be passed in one at a time, you do this using the foreach command.

share|improve this answer
    
Oh okay, I thought a for each was implied with the pipe operator. That works perfectly. –  Jacobm001 Dec 28 '13 at 20:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.