WildFly HOME Directory is determined by the variable JBOSS_HOME.
Therefore, in order to set it on a Linux Machine you need to:
$ export JBOSS_HOME=/home/francesco/jboss/wildfly-17.0.0.Final
For Microsoft Windows, from the Windows Start Menu, select Settings, select Control Panel, select System, select Advanced, then select Environment Variables. Click New. In the Variable Name field, enter JBOSS_HOME. In the Variable Value field, enter the path to WildFly. Click OK to commit your entries, then click OK twice more to close the Environment Variables and System Properties windows, respectively.
Please notice that if you are trying to boot WildFly using a script (e.g. standalone.sh) which is not in the JBOSS_HOME a warning will be displayed:
$ ./standalone.sh WARNING: JBOSS_HOME may be pointing to a different installation - unpredictable results may occur. JBOSS_HOME: /home/francesco/jboss/wildfly-17.0.0.Beta1/