Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. IT & Infrastructure
  4. drag and drop a selection into a .BAT

drag and drop a selection into a .BAT

Scheduled Pinned Locked Moved IT & Infrastructure
helpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Krischu
    wrote on last edited by
    #1

    Hi, I'm new to this forum and this is my first post. I want to select a number of files and drag/drop then onto an icon (behind which is a .bat) Then the .bat should process one file after the other. .bats as I understand only accept 10 arguments (old DOS anachronism) but even on under Unix one has this problem and for that purpose the is a technique, called xargs. Is there something like that (freely) available for Windows?

    D 1 Reply Last reply
    0
    • K Krischu

      Hi, I'm new to this forum and this is my first post. I want to select a number of files and drag/drop then onto an icon (behind which is a .bat) Then the .bat should process one file after the other. .bats as I understand only accept 10 arguments (old DOS anachronism) but even on under Unix one has this problem and for that purpose the is a technique, called xargs. Is there something like that (freely) available for Windows?

      D Offline
      D Offline
      Dan McCormick
      wrote on last edited by
      #2

      Krischu wrote:

      .bats as I understand only accept 10 arguments

      That's not really true - .BAT files can only refer to the first 10 elements on the command line ( %0 - %9, where %0 is the name of the batch file ). If you know you have more ( or suspect you have more ) you can use the 'SHIFT' command to move the arguments 1 place to the left, that is, %1 becomes %0, %2 becomes %1, and so on and what would have been '%10' is now %9. This sample text will print all of the arguments on the command line. @ECHO OFF :LOOP ECHO.%1 SHIFT IF "%1" == "" GOTO END GOTO LOOP :END Place this code in a file called SHFT.BAT and then invoke it with something like: SHFT 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Regards, Dan Remember kids, we're trained professionals.
      Don't try this at home!

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups