Skip to content
⌘ NSIS Forum Archive

How find a file name in a folder

3 posts

r2du-soft#

How find a file name in a folder

hi
I Have Two Question:

1:
i have a file in
C:\Windows\my.file\
I dont know file name! Just I know my File Format is .msi
how can Obtain this file name in a Variable?

2:
How Can Open:
Open All txt File (*.txt) Available in a folder?
OR
Open All File (*.*) Available in a folder?

thankful
T.Slappy#
1. Simply use FindFirst to find any matching .msi files:

FindFirst $0 $1 $WINDIR\*.msi
loop:
StrCmp $1 "" done
DetailPrint $1
FindNext $0 $1
Goto loop
done:
FindClose $0
2. Do You want to open all .txt files in the folder? It seems really suspicious but simply use the method from in point 1 and loop through the all .txt files in fodler and perform appropriate action.

To open all files (*.*) use the *.* mas for FindFirst.

But I am not sure what you mean by "open" because various extensions have various actions to do with the files.