I have a web based application that has a file called login.css. Like any .css file, it’s an extremely long, single line of text. I’ve found I can split it by (‘}’) to return every single value as a single line. My problem is that those values can be different, or in a different order, depending on the version of the software. I know, if all things were equal, I could create my variable like:
$v1, $v2, $v3 = $logincss.split(‘}’)
But all things are not equal… I’m currently trying to turn a result of my split containing loginsplashscreenlogo into variable. I’ve tried:
$loginCSS = gc $filepath $logintest = $logincss.split('}') get-item $logintest | where-object -like '*loginsplashscreenlogo*'
and gotten:
Get-Item : Cannot bind argument to parameter ‘Path’ because it is an empty string.
At line:3 char:10
- get-item $logintest | where-object -like ‘loginsplashscreenlogo’
-
~~~~~~~~~~
- CategoryInfo : InvalidData: (
[Get-Item], ParameterBindingValidationException
- FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.GetItemCommand
- CategoryInfo : InvalidData: (
I’ve tried:
$loginCSS = gc $filepath $logintest = $logincss.split('}') | where-object -like '*loginsplashscreenlogo*'
and gotten:
where-object : The specified operator requires both the -Property and -Value parameters. Provide values for both parameters, and then try the
command again.
At line:2 char:37
- … = $logincss.split(‘}’) | where-object -like ‘loginsplashscreenlogo’
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidArgument: (
[Where-Object], PSArgumentException
- FullyQualifiedErrorId : ValueNotSpecifiedForWhereObject,Microsoft.PowerShell.Commands.WhereObjectCommand
- CategoryInfo : InvalidArgument: (
I figure there’s got to be a fairly simple way to do this, but I haven’t been able to figure it out… Anyone have an idea?