Tuesday, February 27, 2018

Windows batch file not running when double clicked


I have two Windows batch file. Both work when called from command prompt. Only one of the two run runs when double clicked. How come?


The following script (named CopyToStation9.bat) runs with a double-click:


@echo off
for /R "C:\Users\XXX\Documents\XXX" %%f in (*.csv) do copy "%%f" "\\192.168.0.10\c\X"

The following script (named CleanUp.bat) doesn't run with a double-click


@echo off
set delFileList=.\test\
for %%A in (%delFileList%) do (
del /Q %%A
echo file %%A deleted
)

Answer



It looks like you are try to use a UNC path, try using pushdand popd.



https://stackoverflow.com/questions/9013941/how-to-run-batch-file-from-network-share-without-unc-path-are-not-supported-me



No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...