-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Executing .bat script Windows #1385
Comments
Test it in progressive steps. Start by executing a simple direct command, such as copying a file: cmd.exe copy c:\test\a.txt c:\test\b.txt If that doesn't work, try it with the full path to cmd.exe, such as: c:\windows\system32\cmd.exe copy c:\test\a.txt c:\test\b.txt If that now works, now retry it as a batch file, with the "copy c:\test\a.txt c:\test\b.txt" command in the copyfile.bat file: c:\windows\system32\cmd.exe c:\test\copyfile.bat If that works, try it with your own batch file, etc... |
How does the HA-Bridge know what device to target on my network to run these commands? I can give me devices a static IP through my router, but where in HA-bridge do I configure this? |
Well by nature, a "command line" will always be a local command, on the same device that habridge is running on. If you can run a local command that then executes a batch file that can do something over the network (such as curl) then fine , but the command line itself is local. |
Okay, then it seems to be not working I tried just running cmd.exe copy c:\test\a.txt c:\test\b.txt and even though it was successful when I trigger the device "On" state, it doesn't actually run the command and change the name of the .txt file. |
Then you need to start by figuring out why that simple command isn't working. The example I gave you shouldn't change the name of the a.txt file, but copy it to create a b.txt file. You should end up with both files. Make sure you properly create the sample a.txt file, in the proper c:\test path, etc. That's the idea behind this test, to make sure that all paths, etc are good. |
If you open a command line window and manually key in: c:\windows\system32\cmd.exe copy c:\test\a.txt c:\test\b.txt Does that copy the file? |
Nope that didn't work hmmm, maybe its not targeting right executable path for the cmd application |
That's what troubleshooting it with simple commands is all about: testing the "plumbing" to see if everything (paths, permissions, etc) is as expected. Your screen capture of the command line session isn't showing any errors, so the cmd.exe file appears to be in the correct path. In looking at the options for the cmd.exe command, try it with the /c option: c:\windows\system32\cmd.exe /c copy c:\test\a.txt c:\test\b.txt This tells cmd.exe to execute the command line, and then exit. If that works, then try it again but within habridge |
That worked running the command with the /c option! |
Oh shit the HA-bridge worked too!! |
Hehe, the taste of success... Now you can copy files with Alexa voice commands! So now try it as a batch file. Then replace the copy command in the batch file with your own command, etc. |
That's awesome, I'm work right now without my Alexa but will test it with Alexa when I'm home. Thank you! |
For understanding. The Docker Image runs on Windows? How can Ha-Bridge access it? |
I can't figure out from the documentation how I need to format my
Target Item
field inOn Items
call. This is what I currently have and I only want to run a script on my local computer.The text was updated successfully, but these errors were encountered: