This is an extended question to an existing one : Find all files with specific extensions along with their versions
The program successfully populates the text file, thanks to Aacini However, now I am trying to populate the batch file with contents from server. The batch file is kept locally. But this doesn't seems to work at all. If I keep the batch file in the working directory (server) itself, it seems to work fine. I am just trying to avoid the user to move the batch file unnecessarily to the working directory. Below is the code of the batch file.
@echo off
set masterfolder=%cd%
set /p "working_dir=Enter Working Directory location:"
pushd %working_dir%
for %%a in (*.drw.*) do (
if not defined file[%%~Na] (
set "file[%%~Na]=%%~Xa"
) else (
set "ext=%%~Xa"
if !ext:~1! gtr !file[%%~Na]:~1! set "file[%%~Na]=%%~Xa"
)
)
(for /F "tokens=2,3 delims=[]=" %%a in ('set file[') do echo %%a%%b) > mylist.txt
popd
cd /D %masterfolder%
start trail_gen.exe
Precursor : This batch file basically populates a text file with list of the contents within a folder kept on the server. Also, I would like to mention that when I try to run the batch when allocated on the server folder, it asks for "Open-file security warning". Is this causing the issue ? Any help is greatly appreciated.
UPDATE I thought their is an issue with the server location. But I checked if this works with local directory. It does not. I kept the batch file on desktop and tried to find files names from 'Downloads' folder, it does not populates the text.
Here's a general process to set up batch file access to a server:
For example, if you want to read a file from the server, you can use the type command in a batch file: