公告
财富商城
积分规则
提问
发文
2019-09-05 06:27发布
手持菜刀,她持情操
I want to dir a folder and get in a variable all the names of the *.csv files.
Does anyone know how can I do this?
Using Bash you can try:
dirlist=`ls -1 *.csv` echo "$dirlist"
Under windows you can read the following Q and A:
Windows batch files: How to set a variable with the result of a command?
Something like:
for /f "delims=" %%a in ('dir') do @set foobar=%%a
Change 'dir' to what you want. I have no windows machine close by, so cannot test.
I apologize for a duplicate response, but StackOverflow has reputation counters that impede me from certain actions.
When executing directly on the command-prompt, use the following form:
for /f "delims=" %a in ('whoami') do @set myaccount=%a
The form in previous answer is intended when used in a .bat or .cmd file.
最多设置5个标签!
Using Bash you can try:
Under windows you can read the following Q and A:
Windows batch files: How to set a variable with the result of a command?
Something like:
Change 'dir' to what you want. I have no windows machine close by, so cannot test.
I apologize for a duplicate response, but StackOverflow has reputation counters that impede me from certain actions.
When executing directly on the command-prompt, use the following form:
The form in previous answer is intended when used in a .bat or .cmd file.