In general, there's no need to put quotes around {filepath} as Opus will do so automatically if they are needed.
To run different commands on files and folders you can use something like this:
The only thing you should need to change is the command lines to these:
If fs.FileExists(filepath) Then
command = """contig.exe"" -v -a """ & filepath & """"
ElseIf fs.FolderExists(filepath) Then
command = """contig.exe"" -v -s -a """ & filepath & """"
Else