flyingDman wrote: ↑06 Aug 2020, 11:18
Use this to have the ping response go straight to the clipboard:
Code: Select all
s1 := "google.com"
Runwait %comspec% /c ping %s1% | clip,,hide
Use this for it to go to a txt file:
Code: Select all
s1 := "google.com"
Runwait %comspec% /c ping %s1% > %A_Hour%%A_Min%-%A_DD%%A_MM%%A_YYYY%-%s1%.txt,, hide
You'll never see the command prompt window.
I attempted both of those (copy and paste) and only got the first one to work, placing the results straight to the clipboard, and that worked even with all my variables, etc.
The second one, however, I was unable to get working no matter how I put it. For the sake of simplicity - this is what I've tried to get going:
Code: Select all
^!numpad4::
Runwait %comspec% /c cd "C:\Users\User\Desktop\cmdoutput" | ping google.com > TESTING.txt ;,, hide
return
That does not work. No file is created in that directory. I tested it by copy and pasting into cmd for 100% accuracy and it worked
If I edit it a little and have it as so:
Code: Select all
^!numpad4::
Runwait %comspec% /c cd "C:\Users\User\Desktop\cmdoutput" | ping google.com | clip ;,,hide
return
Then it works! It just seems to not want to create the file and paste in there for some reason. I got rid of all the date and time variables just in case they were to interfere with it at all and nothing.
I don't believe that it should require any administrative permissions as it
should run as the current user (I assume).
Is there a way to create a .txt file with the clipboard as the contents? Without seeing any GUI come up on the screen. If that's easier than having to have administrator permissions (which my user does) then I don't see any downside.
PS. The ',, hide' being a comment in both of my examples is to say I have tested it with and without it.