Welcome Guest.   Make a donation to an author on the site April 18, 2014, 06:20:21 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2014! Download dozens of custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: passing parameters to .exe and .bat  (Read 6252 times)
burro
Participant
*
Posts: 4


see users location on a map View Profile Give some DonationCredits to this forum member
« on: August 15, 2008, 09:51:13 AM »

New convert here, from... well, some "other tool" smiley.  Really enjoying the flexibility that FARR is giving me!

Got a quick question.  What is the best way to call a program (be it .exe or .bat or .whathaveyou) with some parameters that I type?  For instance:

%SystemRoot%\System32\mstsc.exe /v:%1

I've tried to make an alias that looks like this:

match on: ^rd (.*)
Run: Remote Desktop | %SystemRoot%\System32\mstsc.exe /v:$$1

But that doesn't seem to do the trick.  I seem to have a lot of other .exe programs that I run on a regular basis that take parameters.  How can I do this?  Been looking around in the forum and on the docs, but I must be blind.

Thanks a ton.  Awesome tool!  Hopefully will be giving some scripts back to the community soon.
Logged
mouser
First Author
Administrator
*****
Posts: 32,668



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #1 on: August 15, 2008, 11:15:32 AM »

three things:

First, welcome!

Second, that alias you specified should work fine -- i think it's important for you/me/us to figure out why its not working properly if it isnt.  Can you tell me any more symptoms, like is it launching the program but without arguments, or not launching it at all.

Third, people have been requesting an easier way to pass parameters to a tool for a while now, and i think it's time for me to add it.  The idea that i think we settled on for how to do this is to allow some way to express on the search line that you want to pass extra paramaters to the launched program, like: "search terms :: param1 param2"  that would tell far that whatever you type after the :: should be passed as commandline parameters.  Thoughts?
Logged
kartal
Supporting Member
**
Posts: 1,529


View Profile Give some DonationCredits to this forum member
« Reply #2 on: August 15, 2008, 01:19:15 PM »

My suggestions

"searchterm tab arguments."
"searchterm > arguments."
"searchterm | arguments."



Logged
burro
Participant
*
Posts: 4


see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #3 on: August 15, 2008, 01:26:20 PM »

Well, seems like the machine needed a restart Sad  I haven't changed anything and the alias does work as expected, as in, it does bring up the Remote desktop tool with the appropriate machine.

I like your idea of having some sort of string that can be used to specify arguments.  Personally, I have a lot of these programs that I need to pass parameters to, and making an alias for each of them has been a bit annoying.  I have managed to make it work though.  I'm wondering if making the string be "$$" instead of "::" would make it more obvious, as "$$" is already used as a prefix to the parameters.

Thanks for the quick response!
Logged
d4ni
Supporting Member
**
Posts: 128


View Profile Give some DonationCredits to this forum member
« Reply #4 on: August 24, 2008, 07:25:58 PM »

I am in favor of the pipe character, |, to split search terms from arguments. It just looks nice, as in it really splits the right and left part, so program from parameters smiley
Logged
burro
Participant
*
Posts: 4


see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #5 on: August 25, 2008, 11:50:51 AM »

Well, it seems like I wasn't crazy in the head after all.  The remote desktop alias that I described in the original post is a real issue.  It is intermitent, and I have not been able to pin down the environment under which it fails and the one under which it works.  As of this writing it has gone back to "not working", and nothing in the config has changed that would seem to make this happen.  Any tips on how I can provide more data to aid debbugin?
Logged
mouser
First Author
Administrator
*****
Posts: 32,668



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #6 on: August 25, 2008, 11:58:15 AM »

try changing the launch method used by FARR on the General options tab.
if it's intermitant then maybe the problem is not with farr..

Logged
d4ni
Supporting Member
**
Posts: 128


View Profile Give some DonationCredits to this forum member
« Reply #7 on: August 27, 2008, 06:41:45 PM »

Works fine iff you change %SystemRoot% to C:\Windows\ or equivalent for your system. Clearly it should work with the environment variable but as a temporary solution I guess you should just use the absolute path, or is it not possible?

Changing the launch method didn't fix the problem.
Logged
burro
Participant
*
Posts: 4


see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #8 on: August 28, 2008, 08:20:37 AM »

Some results:

For all, I had to replace the %var% with the absolute to make it work.

* With: Checked "Use document launch helper utility", used "Method 2 - ShellExecuteEx"
  - The "rd" alias works.
  - Opening a link to a file (which has assosiated program in explorer) does not work.

* With: Checked "Use document launch helper utility", used "Method 1 - ShellExecute"
  - The "rd" alias works.
  - Opening a link to the file works.
Logged
skajfes
Honorary Member
**
Posts: 204


View Profile Give some DonationCredits to this forum member
« Reply #9 on: September 01, 2008, 04:27:42 PM »

Third, people have been requesting an easier way to pass parameters to a tool for a while now, and i think it's time for me to add it.  The idea that i think we settled on for how to do this is to allow some way to express on the search line that you want to pass extra paramaters to the launched program, like: "search terms :: param1 param2"  that would tell far that whatever you type after the :: should be passed as commandline parameters.  Thoughts?

Some way of passing commandline parameters is really needed. Perhaps launchy's method is the most intuitive one. Pressing Tab would add a special visual separator (a triangle if I recall correctly) behind the text in the searchbox and you could write any parameters needed. Now, since Tab is used to autocomplete there should be a check to see if currently selected item in the result list is executable or not before deciding what would be done (autocomplete or take commandline parameters).

In the meantime, here's my alias that helps a little:
[copy or print]
1000>>>exec arguments>->$$1.$$2 $$3>+>(.*).(exe|bat) (.*)

Now the only thing to keep in mind is that you have to enter the full path to the desired application or utility (which is easily done by pressing Tab on the selected item)

Hope it helps,
skajfes
Logged

It is impossible to make anything foolproof because fools are so ingenious.
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.034s | Server load: 0 ]