Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am coding a batch file that will get the directory of a specific file(curl_for_64bit.exe). I tried using the find command but it does not work. It basically gets the directory of the file, changes to that directory so that it can be copied.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
814 views
Welcome To Ask or Share your Answers For Others

1 Answer

you can traverse the directory tree with a FOR command checking for the existence of the required file until it's found

for /r /d %%a in (*) do (
  if exist %%acurl_for_64bit.exe (
    pushd %%a
    goto :eof
  )
)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...