You could solve that with @toggle, but you'd then run into another issue: The command is toggling the pattern and the flag independently of each other, which means they will go out of sync. This fixes that as well:
@toggle:if Set QUICKFILTER=*.exe
@if:Set QUICKFILTER=*.exe
Set QUICKFILTERCLEAR
@if:else
Set QUICKFILTERCLEAR
Set QUICKFILTERFLAGS=showdirs QUICKFILTER=*.exe