What I need to do is, without knowing the name of the directory, I need to load it into a variable so I can use it later in my script.
There should only be one directory. Something like:
\\[server]\[directory]\**[profile]**
Without knowing the name, I need to load "Profile" into a .bat variable.
Thanks in advance!
This will list everything in \\SERVER\\PATH, sorting such the directories are last (in case there are files), and sets 'name' to each: if there is only one directory, it will be the value you need
@echo off
for /f %%i in ('dir /o-g /b \\SERVER\PATH') do set name=%%i
echo result = %name%
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.