my $cmd = 'dfsutil.exe'; my @paths = split /;/,$ENV{PATH}; #defaults my $selecting = "disabled" ; my $selectingtext = "(No $cmd found!)"; my $height = 2; my $weight = 30; for my $p (@paths) { if (-x "$p\\$cmd") { $selecting="active"; $selectingtext=""; $height = 2; $weight = 20; }; }; my $button4 = $main->Button( '-text' => "DFS Export $selectingtext", '-justify' => "left", '-height' => "$height" , '-width' => "$weight", '-relief' => "raised", '-state' => "$selecting", '-command' => sub{BUTTON2() && $main->destroy();}, );