Custom command works if command is .bat file but not if the commands itself is entered
I have the following command which references an external application, but it runs fine if i have hass agent execute a .bat file that contains the command. If I put the command directly into the command field, however, it simply doesnt execute.
I checked the log files, I see nothing at the relevant timestamp
19 Replies
Help us Help Others!
To help others find answers, you can mark your question as solved via
Right click solution message -> Apps -> ✅ Mark Solution

Help us Help You!
Please don't delete messages or posts because it makes it impossible to understand what happened. If you don't want your messages to be seen then don't post here.
Please provide us with the version number of your app.
You can find it by clicking the ? at the bottom of the main page and checking under the logo that shows.We will help as soon as possible. While you're waiting you can try the following:
- Checkout the documentation. - Search here in discord for previously solved similar issues.
@Amadeo
iirc theres a way to get the visible terminal to see if its through an error but idr how
Have you got it setup as a custom command with that command? or a blank with an action payload from Home Assistant?
something like this?

i have it setup as a custom command yeah, not using a payload
Could you try it with a powershell command?
does not seem to work either way with the powershell command, either as a command or trying to execute the bat file. both work fine running it myself in powershell
hmm
I don't have this specific program but I'll configure a dummy command to see it the parameters are passed on correctly
and update
hm, command itself looks ok when passed on to cmd
now to find a way for me to really check it without installing this sound volume view
does it work when you do
?
it does not, no
i am currently on 2.1.0 though and i did see the 2.1.1 beta had this listed:
PowershellCommand argument handling where passing arguments containing spaces/quotes would cause the command to fail (thanks @greghesp for reporting) #204I'm wondering if this is related maybe?
not exactly as it changed only the powershell command
but that kind hints us why it doesn't work with hass.agent, what happens in the background is basically cmd.exe /c <your command>
what about
or
ah sorry i forgot to check this, ill do it tomorrow
both of these work, no issue
Could you try putting them in the hass.agent config? Just remove "cmd /C " from the beginning, for example
'''
""C:\Program Files (x86)\Sound Volume View\SoundVolumeView.exe" /SetSpatial "2- B10PRO\Device\Speakers\Render" """
'''
Oh nice, codeblock do not work on mobile
Thx discord
Nah you used the wrong character
when you say put them in the config file do you mean just make a command cause if so, yeah this seems to work as well
Press
win
+ r
and then paste this:
In there you should be able to find your command config file, open it in an editor and manually change the command for the custom one to the code @Amadeo suggested above
Oh wait the one above works, you can just use that thenyeah both the last 2 suggestions work, it just looks like this in the commands.json lol
so you've edited them in the file or via UI? in general it's cmd quirkness when launches via process that requires those quotes (or rather their number)
which is something that we prolly need to add to the docs rather than fix directly in code