=====[V7] ISSUE:“CMD.EXE was started with the above path as the current directory. UNC paths are not supported. Defaulting to Windows directory.” when running a Windows batch file as a pre or post command from a network drive (5233) ===== ^ Article ID ^ Reviewed ^ AhsayOBM/AhsayACB ^ Operating System ^ | 5233 | 2017-03-10 | 7.3.0.0 to 7.x | Windows | ATTENTION 1st January, 2022: v7 officially End-of-Life [details] ===== Problem Description: ===== When performing a backup job on AhsayOBM/AhsayACB the following error is shown in the backup log, if a Windows batch file is run as a pre or post command from a network drive or UNC path. [YYYY/MM/DD HH:MM:SS] [info] [-] [Pre-Backup-1] xxxx.bat [YYYY/MM/DD HH:MM:SS] [warn] [-] [Pre-Backup-1] '\\UNC_PATH\folder\' [YYYY/MM/DD HH:MM:SS] [warn] [-] [Pre-Backup-1] CMD.EXE was started with the above path as the current directory. [YYYY/MM/DD HH:MM:SS] [warn] [-] [Pre-Backup-1] UNC paths are not supported. Defaulting to Windows directory. [YYYY/MM/DD HH:MM:SS] [warn] [-] [Pre-Backup-1] 'xxxx.bat' is not recognized as an internal or external command, [YYYY/MM/DD HH:MM:SS] [warn] [-] [Pre-Backup-1] operable program or batch file. ===== Cause: ===== The warning message is returned by Microsoft Windows and not Ahsay, it is related to Windows limitation which prevents the running of batch files on UNC paths. **References:** [[https://support.microsoft.com/en-us/help/156276/cmd.exe-does-not-support-unc-names-as-the-current-directory]] [[https://technet.microsoft.com/en-us/library/bb490978.aspx]] [[https://social.technet.microsoft.com/Forums/scriptcenter/en-US/b3243c52-65d4-4fda-a7eb-f94733eaf408/how-to-trap-cmdexe-was-started-with-the-above-path-unc-paths-are-not-supported-message-in?forum=ITCG]] ===== Resolution: ===== A workaround for this Windows limitation is to use a batch file located on a local drive along with the pushd and popd commands to launch the batch file on the network drive. __Example:__ **Batch file :** \\192.168.22.41\Production\current\shutdown_database.bat 1. Create a batch file and save on a local machine to execute the batch file on UNC path or network drive. 2. Call the local batch file (localbatch.bat) in the pre or post command in AhsayOBM/AhsayACB. __localbatch.bat__ echo on pushd \\192.168.22.41\Production\current\ \\192.168.22.41\Production\current\shutdown_database.bat popd {{:public:pre-command.png?direct&800|}} ===== Keywords:===== Pre-command, post-command, UNC, network drive, batch file, popd, pushd, operable program