windows - Assign content of DIR to a variable -


i wrote following cmd

dir /b "%appdata%\mozilla\firefox\profiles" 

which returns following single folder exists @ dir location

4jktnrk2.default 

i wish store 4jktnrk2.default in variable.

i tried following

set a=dir /b "%appdata%\mozilla\firefox\profiles" 

and

set a="dir /b %appdata%\mozilla\firefox\profiles" 

however neither of these work.

i think best not use for loop there 1 folder in directory.

@echo off setlocal enabledelayedexpansion set "dir_c=" /f "delims=" %%a in ('dir /b "%appdata%\mozilla\firefox\profiles"') (     if "!dir_c!" equ "" (         set "dir_c=%%~a"     ) else (         set "dir_c=!dir_c!;%%~a"     ) ) echo %dir_c% 

you have no other option use for /f.there's no unix style assigning result of command variable in batch.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -