Author Topic: Passing command arguments from command line bar to user defined batch script  (Read 79 times)

mmg

  • Newbie
  • *
  • Posts: 5
    • View Profile
Passing command arguments from the command line bar to a user defined batch script does not seem to work.
I wrote a small user defined batch script:

echo arg=${param:0}
pause

After assigning alias "ttt" to the batch script I entered "ttt 123" on the command line bar. Result:
arg=
Press any key ...

Can command line arguments only be passed to Multi-Scripts?
« Last Edit: July 10, 2018, 11:38:44 by mmg »

Mathias (Author)

  • Administrator
  • Elite Member
  • *****
  • Posts: 3213
    • View Profile
    • Multi Commander
Why not just call the bat script directly from alias.. and the parameters from the command line is sent as parameters to the bat file..
and windows will pick them up and you can access them as normal in batch script using %1 and so on

Most multitags should work in bat too, but since they are handle before the command is executed Im not sure parameters from commandline field will work.
feels like the wrong way to do something.
« Last Edit: July 10, 2018, 12:48:27 by Mathias (Author) »

mmg

  • Newbie
  • *
  • Posts: 5
    • View Profile
If command line arguments cannot be passed over I will have to seperate my batch scripts from Multicommander. So far, defining batch scripts inside Multicommander seemed to be a practical all-in-one solution for me, handling all the different types of user defined commands in a similar way.

I suggest to adapt the manual (http://multicommander.com/docs/UDC_batch, "Command Arguments").
« Last Edit: July 10, 2018, 14:03:25 by mmg »

Mathias (Author)

  • Administrator
  • Elite Member
  • *****
  • Posts: 3213
    • View Profile
    • Multi Commander
What are you trying to do..  I can't see a valid use case for it
Are the bat script interacting with MC in some other way ? or is it just the command line parameters you want ?
I'm trying to figure out what you want to do. I think there are better way of doing them.
« Last Edit: July 10, 2018, 14:06:23 by Mathias (Author) »

mmg

  • Newbie
  • *
  • Posts: 5
    • View Profile
For example navigating to a target directory and running "git clone", passing over the git repo path via the command line.

Mathias (Author)

  • Administrator
  • Elite Member
  • *****
  • Posts: 3213
    • View Profile
    • Multi Commander
And why do you need MC to generate a bat.. Can you just use a normal bat file.?
then you get the paramters as normal bat paramters like %1 and %2 and so on..

mmg

  • Newbie
  • *
  • Posts: 5
    • View Profile
That's what I'm going to do now. So far it seemed to be pratical to have it all-in-one, as mentioned before...

Mathias (Author)

  • Administrator
  • Elite Member
  • *****
  • Posts: 3213
    • View Profile
    • Multi Commander
The idea of having MC generate bat files are more if you need it to interact with MC. so if you got part of the bat script that need the path of active panel.
Or if you need the selected file in the script and such.

If you do not really need MC to generate a dynamic custom script everything it is run. Then a fixed script is better. and then just make MC call that..


mmg

  • Newbie
  • *
  • Posts: 5
    • View Profile
Well, interaction with MC is needed in my example mentioned above. I have to run "git clone" from ${sourcepath}.