Use Clipboard instead of temp-file from CMD-prompt - Possible?
Posted: 05 Oct 2020, 09:34
Hi!
Sending a result from a CMD prompt (eg dir) to a temporary file (c:\temp\out.txt) is not difficult. (something like this)
The only problem I see with this is that the file does not have the correct Code Page - for me.
17 File(s) 729ÿ775ÿ009 bytes (ÿ instead of "space")
But is it possible (in some way) to send the result directly to an variable och Clipboard from the CMD-window?
Something like this .: (don't work) (maybe better to save Clipboard before CMD/dir and restore after CMD/dir?)
Sending a result from a CMD prompt (eg dir) to a temporary file (c:\temp\out.txt) is not difficult. (something like this)
Code: Select all
outFile := "c:\temp\out.txt"
If FileExist(outFile)
FileDelete %OutFile%
RunWait % ComSpec " /c dir c:\temp\*.* > " outFile,, Hide
FileRead DirTree, %outFile%
FileRecycle %outFile%
MsgBox ,, %A_ScriptName% - Row %A_LineNumber%, Ready! `n`n%DirTree%
17 File(s) 729ÿ775ÿ009 bytes (ÿ instead of "space")
But is it possible (in some way) to send the result directly to an variable och Clipboard from the CMD-window?
Something like this .: (don't work)
Code: Select all
Clipboard := ""
RunWait % ComSpec " /c dir c:\temp\*.* > " Clipboard,, Hide
MsgBox % ClipBoard