Why is Get-Content inserting extra subdirectories in directory path
can please @ following 6 lines of code , explain output i'm receiving? i've been looking @ code segment week trying figure out possibly wrong , can't. @ point i'm convinced it's weird powershell bug - i'd happy if here prove me wrong, explain i'm seeing , tell me how correct it. "logit" irrelevant issue - it's simple function calls tee-object print line screen , write file. added here string code inspect line looks after substitution. value of $servertype when code snippet runs "core" (as can see in output).
> echo "substituting data c:temp\setup-$servertype\updates\media\travel\con.html" | logit
> $here = @"
> inputfile = get-content "c:temp\setup-$servertype\updates\media\travel\con.html"
> "@
> $inputfile = get-content "c:temp\setup-$servertype\updates\media\travel\con.html"
> echo "the here string is: $here" | logit
here output above code...
2015-01-28t13:54:05 - jim - - substituting data c:temp\setup-core\updates\media\travel\con.html
get-content : cannot find path 'c:\temp\setup-core\temp\setup-core\updates\medi
a\travel\con.html' because not exist.
2015-01-28t13:54:05 - jim - - here string is: inputfile = get-content "c:temp\setup-core\updates\media\travel\con.html"
i deleted error info above output illustrate problem more (i'll paste below). problem path cannot found has first 2 directory levels duplicated (c:\temp\setup-core\temp\setup-core\...) instead of (c:\temp\setup-core\...) - note difference in case of word "core".
how , why happening - , need make work properly?
thanks in advance takes time reply. here missing lines output above (i'm pretty sure it's not relevant):
at c:\temp\setup-core\scripts\travel.ps1:196 char:14
+ $inputfile = get-content
"c:temp\setup-$servertype\updates\media\travel\co ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ categoryinfo : objectnotfound: (c:\temp\setup-c...el\con.ht
ml:string) [get-content], itemnotfoundexception
+ fullyqualifiederrorid : pathnotfound,microsoft.powershell.commands.getco
ntentcommand
hi tenly,
check path using:
missing "\" after "c:".
cheers,
fred
there's no place 127.0.0.1
Windows Server > Windows PowerShell
Comments
Post a Comment