You can control the display of error dialogs through the API SetErrorMode(). Using Win32::API::Prototype it looks like this. See the link for possible values of the argument and note that they are bit flags that can be or'd together.
#! perl -slw use strict; use Win32::API::Prototype; ApiLink( 'Kernel32', q[ UINT SetErrorMode( UINT uMode ) ] ); SetErrorMode( 0x8000 ); ## Updated per ikegami's correction below. if( -e $ARGV[ 0 ] ) { print 'Found it?' } else { print 'Not found'; }
In reply to Re: Prevent windows dialog when using file test -e
by BrowserUk
in thread Prevent windows dialog when using file test -e
by Outaspace
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |