[Windows XP] File Associations + Command Line arguments

Discussion in 'Techie Discussion' started by Shovel, Jan 23, 2004.

  1. Shovel

    Shovel Can't get enough of FH

    Fairly simple one I hope.

    I run Perl on my system for uber scripting purposes (I haven't got around to learning vbs), and for ages have just had ".pl" associated with Perl.exe. Today I wrote a script that actually takes command line arguments and discovered a problem. Through the association, the command line arguments don't get passed on.

    If, alternatively, I run: "perl myscript.pl rah!" it will work though.

    Does anyone know how to set up a file association that will pass on the command args automagically? Thank you :)
     
  2. Shovel

    Shovel Can't get enough of FH

    Heh: Fixed already. I looked up the settings for .vbs files and copied it from there.

    For reference then, the application assicated with my "Run" (or "Open") action now looks like:
    Code:
    E:\Win\Perl\bin\perl.exe "%1" %*
    The %1 refers to the file name of the script, while the %* (which I was originally missing) is critical as it passes on all additional command line args.
     
  3. Shovel

    Shovel Can't get enough of FH

    I came across another little addition for this today.

    If you add ".pl;" to your PATHEXT environment variable you can launch Perl scripts without adding the .pl extension at the prompt.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.