in reply to Perl/Tk invoking a batch command and passing argument

system, Capture::Tiny, Proc::Background, system_detached

sub gen_rslt { if( $filepath ){ system $pathtobatchfile, '--first', $filepath; } else { $mw->MsgBox( -detail => "select path first", -title => "select +path first " )->Show; } }

... my $my_Button3 ...

Use meaningful variable name, not $my_Button3 but $exitButton

A good 98% of all vars you use should be "my" vars so you shouldn't feel the need to use that my_ in the name

Here are tips and links and links and link on crucial tk info you need :)

tk tips like this... tk scoping issue, tk closures people, Re: TK Submenus (Tk::Menu , global variables/ spirit of strict), tk scoping function argument passing, can't share Tk mainwondow between threads