And so your explanation for why Parameter=Write-Host "I need this displayed" works perfectly would be... what?death.crafter wrote: ↑September 3rd, 2021, 3:09 pm Screenshot 2021-09-03 203801.png
Powershell is behaving correctly. Rainmeter isn't. Try Parameter=echo """"I need this displayed!""""
It is currently March 29th, 2024, 5:54 am
[(NOT A)BUG]Double Quotes and RunCommand Parameter
-
- Rainmeter Sage
- Posts: 2588
- Joined: March 23rd, 2015, 5:26 pm
Re: [BUG] Double Quotes and RunCommand Parameter
-
- Rainmeter Sage
- Posts: 1399
- Joined: April 24th, 2021, 8:13 pm
Re: [BUG] Double Quotes and RunCommand Parameter
SilverAzide wrote: ↑September 3rd, 2021, 3:14 pm And so your explanation for why Parameter=Write-Host "I need this displayed" works perfectly would be... what?
You do not have the required permissions to view the files attached to this post.
from the Realm of Death
-
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [BUG]Double Quotes and RunCommand Parameter
There seems to be some issue with how echo aka Write-Output is being handled with RunCommand. I can't put my finger on it. It all works as expected in the PowerShell UI, but not with RunCommand. Write-Host seems to work fine, and is what I would use.
-
- Rainmeter Sage
- Posts: 1399
- Joined: April 24th, 2021, 8:13 pm
Re: [BUG]Double Quotes and RunCommand Parameter
It's not only echo or Write-Output.
Try Parameter=(Get-ChildItem "C:\Program Files (x86)").Count
RunCommand is just stripping off the double quotes.
After some testing...
LMAO!!!
Try this
Code: Select all
[RunCommand]
Measure=Plugin
Plugin=RunCommand
Parameter=echo "I need this displayed!"
OutputType=ANSI
from the Realm of Death
-
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [BUG]Double Quotes and RunCommand Parameter
The output of cmd.exe is not ANSI...death.crafter wrote: ↑September 3rd, 2021, 3:27 pm It's not only echo or Write-Output.
Try Parameter=(Get-ChildItem "C:\Program Files (x86)").Count
RunCommand is just stripping off the double quotes.
After some testing...
LMAO!!!
Try this
Code: Select all
[RunCommand] Measure=Plugin Plugin=RunCommand Parameter=echo "I need this displayed!" OutputType=ANSI
-
- Rainmeter Sage
- Posts: 1399
- Joined: April 24th, 2021, 8:13 pm
Re: [BUG]Double Quotes and RunCommand Parameter
Ahh I see. Yeah it works fine.
Then why do the quotes in powershell parameter get removed
from the Realm of Death
-
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [BUG]Double Quotes and RunCommand Parameter
Well, that's the 64,000 dollar question isn't it... Seems like somehow the "interface" between RunCommand and PowerShell is stripping them out of the Parameter. Hard to say if this is a RunCommand issue exactly, or a PowerShell issue that is only manifested due to how we pass the command to it. I'm sure Brian will look into this, but at least for now, I would recommend using 'single quotes' instead of "double quotes" in parameters to PowerShell. Just like we recommend using single quotes in Lua scripts.death.crafter wrote: ↑September 3rd, 2021, 3:35 pm Ahh I see. Yeah it works fine.
Then why do the quotes in powershell parameter get removed
-
- Rainmeter Sage
- Posts: 1399
- Joined: April 24th, 2021, 8:13 pm
Re: [BUG]Double Quotes and RunCommand Parameter
Parameter=Write-Output """"$('Can't be helped,'+' I guess!')""""jsmorley wrote: ↑September 3rd, 2021, 3:37 pm Well, that's the 64,000 dollar question isn't it... Seems like somehow the "interface" between RunCommand and PowerShell is stripping them out of the Parameter. Hard to say if this is a RunCommand issue exactly, or a PowerShell issue that is only manifested due to how we pass the command to it. I'm sure Brian will look into this, but at least for now, I would recommend using 'single quotes' instead of "double quotes" in parameters to PowerShell. Just like we recommend using single quotes in Lua scripts.
from the Realm of Death
-
- Rainmeter Sage
- Posts: 1399
- Joined: April 24th, 2021, 8:13 pm
Re: [BUG]Double Quotes and RunCommand Parameter
Thanks a lot for looking in to this. Hope Brian finds a feasible solution.
from the Realm of Death
-
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [BUG]Double Quotes and RunCommand Parameter
He might, but to be honest I don't see any important distinction between single quotes that work, and double quotes that don't.death.crafter wrote: ↑September 3rd, 2021, 3:44 pm Thanks a lot for looking in to this. Hope Brian finds a feasible solution.
Code: Select all
[MeasureRun]
Measure=Plugin
Plugin=RunCommand
Program=Powershell
Parameter=echo 'I need this displayed'
OutputType=ANSI
Parameter=Write-Output 'I need this displayed'
Parameter=Write-Host 'I need this displayed'
All those work identically and equally well.
I could see this being an issue worth dealing with though, as this would be a problem:
Parameter=Write-Host 'I "need" this displayed'
That would need to be:
Parameter=Write-Host 'I \"need\" this displayed'
Seems like the interface between RunCommand and PowerShell just yaks up a hairball on "quotes".