CONTEST for SHORT Code snippet for DOS shell Windows batch SCRIPT short simple to understand or oneliner

  • Status: Closed
  • Prize: $20
  • Entries Received: 3
  • Winner: dany3j

Contest Brief

This is a CONTEST for a CODE SNIPPET for WINDOWS 10 command line DOS batch shell oneliner/script.

I have a file called FULLPATHS.txt with content:

/blabla/bla/importantUniqueNameHere/package.exe
/blablablabla/blahaha/importantUniqueNameHere/package.exe
/blapath/blapath/importantUniqueNameHere/package.exe
...

Basically the 3rd field/directory-name is AWAYS the UNIQUE name that I want to download/save file as.

You must IMPROVE the line below or replace with something different/better:

for /F %i in (FULLPATHS.txt) do (Download.exe %i )

The above line will DOWNLOAD those "package.exe" files into the current directory, but of course since they all end in package.exe , they OVERWRITE and you end up with just ONE file.

You must provide BETTER SOLUTION which saves with FILENAME as the "importantUniqueNameHere".exe

You can use nested for loops, you can use setlocal delayedexpansion , tokens etc or you can combine dos shell with windows perl or with GNU awk/gawk for windows. You can even provide a PowerShell solution.

Be CREATIVE but BEST WINNING SOLUTION will be the SIMPLEST easiest to understand, so that the methods can be re-used easily in future. I prefer short oneliners over full blow "scripts". Short fast and simple is best :)

I look forward to seeing your creative solutions!
Thanks!

Recommended Skills

Employer Feedback

“Daniel is great, he was first to post the best working solution!”

Profile image jvirt, United States.

Public Clarification Board

No messages yet.

How to get started with contests

  • Post your contest

    Post Your Contest Quick and easy

  • Get tons of entries

    Get Tons of Entries From around the world

  • Award the best entry

    Award the best entry Download the files - Easy!

Post a Contest Now or Join us Today!