Shigeya Tanabe
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by Shigeya Tanabe
-
-
What I am trying to do is in your reference link. []
I use start-demo function mentioned in that blog post to automate demo. Start-demo reads one-liners from text file and invoke them line by line. As written in the post, it invokes command line like following,
Invoke-Expression $(".{" + $_lines[$_i] + "}| out-host")
$_lines holds one-liners read from text file.
When I added 'get-date|out-gauge -refresh 0:0:1' to my demo commands for example, out-gauge shows error I wrote earlier. Out-gauge was invoked as
.{ get-date | out-gauge -refresh 0:0:1 } | out-host
While following invokes out-gauge -refresh without error.
Invoke-Expression $(".{`n" + $_lines[$_i] + "}| out-host")
Actual lines would be
{
get-date | out-gauge -refresh 0:0:1 } | out-host
-
When I tried this script,
&{get-date | out-gauge -refresh 0:0:1}
An error icon appears on the gauge which says closing "}" is missing.
I guess out-gauge captures commands before pipe so that error would be reasonable.
Any workaround to use refreshing commands within a single line script block?
-refresh within script block does not work
in PowerGadgets Support
Posted
Thanks for your detail! Now the situation I encounter is clear.
And thanks for your workaround too.
I tried to use function start-gadget { xxx } instead of your idea, however it does not work.
So, set/get-content is the best I think.