It has to do with permissions. When you run the script from the client it runs under the account you are logged in as. When you run a script in the gateway it runs on the gateway and uses the local system account. That mapped drive doesn’t exist for the local system account.
You can change which account the Ignition Windows service runs under by going to the Services Control Panel. It is under Control Panel > Administrative Tools > Services. Right click on the Ignition service and select Properties. Click on the Log On tab and change it from the local system account to this account (which is a valid domain account that has access to the shared directory). Once you do that restart Ignition and change your script to access “\MyComputerName\SharedFolder” like Robert suggested.
Let us know if you continue to have issues.