0

I am attempting to use a looping batch file to launch the CMD app ssdeep and pass a file argument to it, then keep the ssdeep window open to copy a chunk of output to the clipboard I have the following code:

@ECHO OFF
:start
SET /p filetohash= What file would you like to fuzzy hash? 
START C:\Users\Josh\Desktop\ssdeep-2.10\ssdeep-2.10\ssdeep.exe %filetohash%
PAUSE
goto start

This allows me to run the batch file, which I can then drag and drop a file to hash into the CMD window. Upon hitting return, the ssdeep CMD window appears for the moment it takes to hash the file, then closes. This leaves me with the 1st window generated by the batch file, that is requesting a key press.

I want to have the 2nd CMD window stay open so I can copy the hash out. Similar to the PAUSE I used in the batch file, but I need it to apply to the 2nd CMD window created.

I'm not exactly sure how to search for this information. I have searched info on batch files. I used these resources to get thus far:

https://superuser.com/questions/582095/how-to-create-a-batch-file-that-will-run-cmd-and-a-exe-with-parameters

and

Batch files : How to leave the console window open

Thanks in advance,

PTW-105

4

1 回答 1

1

使用 /b 切换到启动命令 - 看看它是否符合您的需要(保留暂停)。

start "" /b C:\Users\Josh\Desktop\ssdeep-2.10\ssdeep-2.10\ssdeep.exe %filetohash%

如果您在命令中添加了带引号的项目,则空的双引号会保护启动命令。

试试这个命令hash.txt在你的桌面上创建 - 删除pause- 如果它被打印到 STDOUT,它应该包含信息。可以对其进行解析以仅提取哈希:如果您将该信息添加到您的问题中,它应该采用我们可以阅读并了解如何解析它的格式。

start "" /b C:\Users\Josh\Desktop\ssdeep-2.10\ssdeep-2.10\ssdeep.exe %filetohash% >"%userprofile%\desktop\hash.txt"
于 2013-10-07T02:52:43.253 回答