This is untested, but something along these lines should work:
$dataOne = Import-CSV C:\Path\To\File1.csv
$dataTwo = Import-CSV C:\Path\To\File2.csv
foreach ($row in $dataOne){
$row.Field2 = $($dataTwo | Where-Object{$_.FieldOne -eq $row.FieldOne}).FieldTwo
}
$dataOne | Export-Csv...
Is this supposed to be xml? Multiple roots are not valid for xml are they?
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Got it. Just me forgetting about CSV double quote interpolation. Just needed to double up my double quotes.
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" -...
Ok, so I'm actually doing this in Powershell, but asking the question here because I suspect that this is where I will find somjeone that knows the answer. :) It's all COM and Office automation anyway so language doesn't matter a lot in this.
Here is the situation, I have a CSV...
Then look at WScript.STDIN.ReadLine
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Look at the documentation for the InputBox function.
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Well, without an upper limit on the length of the string, there is potentially an infinite size. So there is no way to uniquely represent an infinite amount of data in 15 characters or less.
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational...
In that case you may be able to navigate through the WMI Win32_Process class to use the .ParentProcess property to figure it out.
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the...
The easiest way would be for the external programs to call it with an argument that identifies the program that called it.
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is...
I understood the question, and crobin1 had already provided a good answer. I was just suggesting an alternate solution to what you were trying to do.
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy...
Just as a quick example, if you wanted to 0 pad a number out to 2 digits:
$a = 5
"{0:0#}" -f $a
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Just out of curiosity, are you trying to write code to zero pad or some other way format strings? If so, there are probably existing commands to do that for you.
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good...
$($a)0" will work.
I'm not sure that I understand your second question.
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
you have an extra "
objShell.Run("%COMSPEC% /c Echo Y| setspn.exe -A http/" & objWebsite & " " & objServer", 1, True)
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the...
You find this behavior strange? I don't know of any language that behaves in any other fashion. There is no implied order in a Type definition. So there is no way to make the engine understand that Field1 is the first 30 characters. Or is Field2 the first 6? Maybe Field3 is 4 characters starting...
Let's try to be a little more explicit and see if that helps. See what happens with this:
foreach ($folder in Get-ChildItem)
{
foreach($proc in Get-ChildItem)
{
$procName = $proc.name
$fileName = "C:\$procname.txt"
$proc.script() | Out-File $fileName
}
}
"... isn't sanity really...
I do not have SQL Server installed so it is hard for me to test, but do the procs have a .Name property? Are they stored as regular files? Do they have a .Script() method?
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you...
If that works then yes, that is exactly what I meant. If not, then clearly I meant something else. :)
To be honest with you I'm not sure what you are trying to do. Dir would create a collection of objects representing all the files and folders in the current working directory. You are looping...
I think you need to move your Out-File inside the preceding loop.
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
What about "C:\$name.txt"
"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.