How to retrieve information from Bash or CMD
-
- Posts: 1
- Joined: Feb 21st, ’17, 17:05
How would one read in CMD and Bash output to then put through a regular expression and do some conditional testing on?
Here is one example using AutoHotkey command syntax:
What exactly are trying to do?
More information: https://www.autohotkey.com/docs/FAQ.htm#output
Code: Select all
RunWait %comspec% /c dir > C:\My Temp File.txt
FileRead, VarToContainContents, C:\My Temp File.txt
FileDelete, C:\My Temp File.txt
MsgBox % VarToContainContents
More information: https://www.autohotkey.com/docs/FAQ.htm#output
-
- Posts: 34
- Joined: Aug 2nd, ’14, 20:50
with the following example you can also get by without writing output to a file but the disadvantage is that the cmd.exe pops up for a second, so I personally prefer the option Marko provided earlier, where the cmd window can be hidden.
to hide the cmd window
Code: Select all
FilePath=C:\test.jpg
objShell := ComObjCreate("WScript.Shell")
objExec := objShell.Exec(ComSpec " /c C:\Users\Username\Documents\FastKeys\exiftool.exe -XPKeywords " FilePath) ;Get the Tags/Keywords of the Image File
strStdOut := ""
while, !objExec.StdOut.AtEndOfStream
strStdOut := objExec.StdOut.ReadAll()
MsgBox %strStdOut%
return
Code: Select all
Runwait, %comspec% /c C:\Users\username\Documents\FastKeys\exiftool.exe -XPKeywords "%FilePath%" > C:\Users\Username\Documents\FastKeys\temp_tags.txt, , Hide ;Write the Image Tags/Keywords Temporarily to a File