Two more things...

In the scripts, "Pause" is supposed to be on a new line, not on the same line 
as "Start-Process". 

Also I forgot to mention that there is a new version of ClamWin released June 
7th that should work okay: https://clamwin.com/content/view/251/1/

Regards,
Micah


> -----Original Message-----
> From: clamav-users <clamav-users-boun...@lists.clamav.net> On Behalf Of
> Micah Snyder (micasnyd) via clamav-users
> Sent: Sunday, June 20, 2021 12:29 PM
> To: ClamAV users ML <clamav-users@lists.clamav.net>
> Cc: Micah Snyder (micasnyd) <micas...@cisco.com>
> Subject: Re: [clamav-users] MS Windows Explorer Context Menu sendto
> (clamscan.exe) - how to keep cmd box open to view results?
> 
> Hi Robert,
> 
> You're correct that there is no config file for clamscan.exe. There also 
> isn't any
> config option to have the command-line applications stay open if you're
> double-clicking them.  ClamAV wasn't designed to be double-clicked.  The
> problem you're facing is not really specific to ClamAV but really is for any
> command line application.  But I think I can help...
> 
> I too initially stumbled on the "cmd /k" trick but you're right that multiple
> arguments get too complicated.  It is instead pretty easy to do with 
> PowerShell.
> Here are some scripts that should work for you for freshclam and clamscan.
> The "Pause" at the end will keep the window open until you press "Enter".
> These scripts should handle any number of arguments, and you can hardcode in
> some arguments like I have in ClamScan.ps1.
> 
> FreshClam.ps1:
> 
> param(
>     [Parameter(ValueFromRemainingArguments=$true)][String[]]$ScanArgs
> )
> 
> $MyProgram = "C:\Program Files\ClamAV\freshclam.exe"
> $Arguments = "$ScanArgs"  # <-- feel free to add extra args if you want.
> 
> Write-Output "Running: $MyProgram $Arguments"
> Start-Process $MyProgram -Wait -NoNewWindow -ArgumentList $Arguments
> Pause
> 
> 
> ClamScan.ps1:
> 
> param(
>     [Parameter(ValueFromRemainingArguments=$true)][String[]]$ScanArgs
> )
> 
> $MyProgram = "C:\Program Files\ClamAV\clamscan.exe"
> $Arguments = "--max-filesize=2000M --max-scansize=4000M $ScanArgs"
> 
> Write-Output "Running: $MyProgram $Arguments"
> Start-Process $MyProgram -Wait -NoNewWindow -ArgumentList $Arguments
> Pause
> 
> 
> Please let me know how this works for you.
> 
> Cheers,
> Micah
> 
> 
> > -----Original Message-----
> > From: clamav-users <clamav-users-boun...@lists.clamav.net> On Behalf
> > Of RW Jones via clamav-users
> > Sent: Sunday, June 20, 2021 7:00 AM
> > To: clamav-users@lists.clamav.net
> > Cc: RW Jones <r...@sdf.org>
> > Subject: [clamav-users] MS Windows Explorer Context Menu sendto
> > (clamscan.exe) - how to keep cmd box open to view results?
> >
> >
> > BACKGROUND:
> > MS Windows 7 SP1 x64 Pro and Home Premium.  Also intending MS Windows
> > 10, Pro.
> >
> > I used ClamWin for a few years as adjunct to Windows Defender mainly
> > to scan one or two isolated downloads but also in case Defender got
> > temporarily munged.  But around February this year the signature updates
> stopped.
> > Someone posted a workaround with some substitute program files at the
> > ClamWin forum* but I decided I would try ClamAV's own official MS
> > Windows port (no GUI) so I installed "Traditional executable installer
> > that will install ClamAV in the "c:\Program Files\ directory", x64.  I am 
> > not
> using clamd.
> > *   http://forums.clamwin.com/
> >
> > THE QUESTION:
> > I don't want scan on access, just clamscan.exe to be invoked against
> > specified files via selecting them in Windows Explorer or similar e.g.
> > FreeCommander XE and then using Explorer context menu's sendto to
> > direct them to clamscan.exe.  This works, but the cmd box which opens
> > does not stay open / static after the last message is printed to
> > screen by clamscan.exe.  User may watch the output in real time and check if
> "OK"
> > comes up against specific files but I would prefer to do unattended
> > momentarily especially if more than a couple of files.
> >
> > Are there any settings to tweak somewhere to accomplish this?  I see
> > there
> > are:
> > freshclam.conf
> > and
> > clamd.conf
> > but seemingly no *.conf for the executable clamscan.exe.  Nothing in
> > folder   conf_examples
> >
> > (As for freshclam.exe I have created a Desktop icon to run it as
> > Administrator which works and one can monitor its progress in the cmd
> > box that opens, but again that closes on program termination - it's
> > worked every time over the last
> > 3 months since installation so I have not explored the logging
> > capabilities, but ideally the cmd box should remain open until dismissed by
> user).
> >
> >
> > I briefly investigated whether this is an MS Windows cmd box setting
> > but I can't find one offhand. There is cmd /k for MS Windows batch
> > files but I'm not using a batch file because it gets complicated if
> > more than one file is ot be selected and scanned (and seemingly
> > parameters/arguments are limited to nine: %1 to %9. In the 1990s days
> > "DOS lets batch files examine up to nine options typed after a batch
> > file name at the DOS
> > prompt.") I've assumed modern cmd likewise.
> >
> > There are probably more complexities with batch files which I don't
> > want to investigate at this time.  I had tried the setting change for
> > cmd in Registry as per "Leonard" comment here
> >
> > https://www.itechtics.com/3-ways-to-prevent-command-prompt-from-closin
> > g-
> > after-running-commands/#comments
> >
> > without changing the first line regarding batch files, but it made no
> > difference; the box just closed on program termination. (The Registry
> > value fwiw was changed to /k "%1" %*  which I've changed back to
> > default of same ie. omitting /k).
> >
> > How is this retention of open cmd box accomplished?  Is there a
> > clamscan.conf which can be created to achieve this?  (None I see in
> > the distribution).  I haven't yet looked into logging options but it
> > would be inconvenient to use it routinely to check for positives; it's
> > more efficient to see the output of clamscan.exe and if toxic, discard the
> scanned file and seek another source.
> >
> > Or one for the developer list?
> >
> > Regards,
> >
> >
> >
> > Robert Jones
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > THIS E-MAIL AND ANY ATTACHED FILES ARE CONFIDENTIAL AND MAY BE
> LEGALLY
> > PRIVILEGED. If you are not the addressee, any disclosure,
> > reproduction, copying, distribution or other dissemination or use of
> > this communication is strictly prohibited. If you have received this
> > transmission in error please notify the sender immediately and then
> > delete this e-mail. All liability for viruses is excluded.
> >
> > r...@sdf.org
> > SDF Public Access UNIX System - http://SDF.org
> >
> > _______________________________________________
> >
> > clamav-users mailing list
> > clamav-users@lists.clamav.net
> > https://lists.clamav.net/mailman/listinfo/clamav-users
> >
> >
> > Help us build a comprehensive ClamAV guide:
> > https://github.com/vrtadmin/clamav-faq
> >
> > http://www.clamav.net/contact.html#ml
> 
> _______________________________________________
> 
> clamav-users mailing list
> clamav-users@lists.clamav.net
> https://lists.clamav.net/mailman/listinfo/clamav-users
> 
> 
> Help us build a comprehensive ClamAV guide:
> https://github.com/vrtadmin/clamav-faq
> 
> http://www.clamav.net/contact.html#ml

_______________________________________________

clamav-users mailing list
clamav-users@lists.clamav.net
https://lists.clamav.net/mailman/listinfo/clamav-users


Help us build a comprehensive ClamAV guide:
https://github.com/vrtadmin/clamav-faq

http://www.clamav.net/contact.html#ml

Reply via email to