EDIT: Found the answer here. (http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/OLE~COM~ADO~CDO~ADSI~LDAP/Samples~from~Users+Directory~Browse~Dialog~Created~Using~OLE~Shell~Functions.txt)
This is a strange one.
TargetLoc = AskDirectory("Select Backup Directory", "", "","",4)
Message ("Target Directory", TargetLoc)
As an example, I'd like to create the folder "D:\Archive\"
I perform the steps below:
- Choose the D drive.
- Press the "Make New Folder" button.
- Type in "Archive".
- Press "Enter" to set the new name.
- Click the "OK" button to return to the script.
Results:Explorer -> The directory "D:\Archive\" is created.
Winbatch -> TargetLoc returns "D:\New folder\"
It doesn't matter what drive or directory I choose to create a new folder, the results are always the same. The directory is created but Winbatch returns "New folder".
This is an old problem that has been known about for a very long time. The root source is a bug in the Windows Explorer shell introduces many years ago that Microsoft never fixed in the original shell API.