'Hide popup window when exectuing commad line

I have a VBA code that enables me to loop through TIFF images in specific folder to determine the compression type and the code is working fine except for one point, which is the following: with each file, a popup window appearing and after a second disappears. How can I get rid of the popup window of the command prompt console?

Sub Test()
    Dim wshShell As Object, sFolder As String, strFile As String, sCommand As String, sOutput As String, r As Long
    sFolder = ThisWorkbook.Path & "\TestFolder\"
    strFile = Dir(sFolder & "*tiff*")
    Do While Len(strFile) > 0
        sCommand = "exiftool -s -s -s  -compression " & sFolder & strFile
        Set wshShell = CreateObject("WScript.Shell")
        sOutput = wshShell.Exec(sCommand).StdOut.ReadAll
        r = r + 1
        Cells(r, 1).Value = Replace(strFile, ".tiff", "")
        Cells(r, 2).Value = Application.Trim(Split(sOutput, vbCrLf)(0))
        strFile = Dir
    Loop
End Sub

The question is related to another topic on the following link Split multi-page tiff image using python



Solution 1:[1]

I could solve it with a workaround of exporting the result of the command line to a temp text file

Sub Test()
    Dim fso As Object, wshShell As Object, sFolder As String, sFile As String, sCommand As String, sOutFile As String, sOutput As String, r As Long
    Set fso = CreateObject("Scripting.FileSystemObject")
    sFolder = ThisWorkbook.Path & "\IDs\"
    sFile = Dir(sFolder & "*tiff*")
    sOutFile = ThisWorkbook.Path & "\Out.txt"
    Do While Len(sFile) > 0
        sCommand = "cmd /c exiftool -s -s -s  -compression " & sFolder & sFile & " > " & sOutFile & ""
        Set wshShell = CreateObject("WScript.Shell")
        wshShell.Run sCommand, 0, True
        With fso
            sOutput = .OpenTextFile(sOutFile).ReadAll()
            .DeleteFile sOutFile
        End With
        r = r + 1
        Cells(r, 1).Value = Replace(sFile, ".tiff", "")
        Cells(r, 2).Value = Application.Trim(Split(sOutput, vbCrLf)(0))
        sFile = Dir
    Loop
End Sub

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 YasserKhalil