Got a .bat file. It works well but......

Discussion in 'Scripting' started by tnx, Jan 28, 2021.

  1. haz367

    haz367 MDL Addicted

    Jan 11, 2020
    798
    1,444
    30
    You're more pro then i am :) I'm more of a lurker and have great respect for those with those skills :)

    Nicely done and sexy icon....keep up the great work.
     
  2. tnx

    tnx MDL Expert

    Sep 2, 2008
    1,695
    267
    60
    After doing a fare bit of testing my project .exe the more I started to dislike starting the .exe and having it read from the clipboard. I couldn't control it as much as I would like to. I got better results with having the .exe read from a .txt file.
    I can control what is written to the file and how it is read from.
    So I tweaked the script a bit and I now have this..

    Code:
    mshta vbscript:CreateObject("wscript.shell").Run("cmd /c chcp 65001 && echo | set /p x=""%1"" | clip | nircmd clipboard writefile C:\VeriHash\Image.txt | c:\VeriHash\VeriHash.exe",0)(window.close)
    
    Obviously written in the .reg file it looks like this

    Code:
    @="mshta vbscript:CreateObject(\"wscript.shell\").Run(\"cmd /c chcp 65001 && echo | set /p x=\"\"%1\"\" | clip | nircmd clipboard writefile C:\\VeriHash\\Image.txt | C:\\VeriHash\\VeriHash.exe\",0)(window.close)"
    It uses the third party .exe nircmd, which is living in Windows.

    First impressions are it is working well. More testing is needed though.

    I can imagine more tweaking in the future.