我有一些长度未知的文件URL输入到我的批处理脚本中。
http://Repository.com/Stuff/Things/Repo/file1.csv
http://www.place.com/Folder/file2.xml
他们之间几乎没有任何一致性。我需要一种仅使用批处理的方法(尽管从批处理内调用PowerShell也是一种选择)来将它们分解为完整的路径和文件名。http://Repository.com/Stuff/Things/Repo/
file1.csv
file2.xml
我看过很多其他语言的做法,但是我只会批处理,它并不是我的强项。我尝试使用一个带有“delims=/”的远程/f循环,但是当它到达//时就会停止运行。
http://repo.com/file.csv/file.csv
,它可能会失败... - undefined|
,并在for
循环之后将其删除,@Aacini; - undefinedfor /F "tokens=2 delims=/" %%a in ("%url%") do set "host=%%a"
- undefined