1

Everytime when I work with Perl (only through cmd) I put in C:\Perl520\Perl64\bin\perl.exe before my script Test.pl. Now I want to run my script by only typing Test.pl. I have already looked through similiar questions like:

https://docs.sdl.com/791187/706364/sdl-contenta-5-7/associating--pl-files-with-strawberry-perl--windows-only-

How Do I Run a Perl Script from Cmd without typing "perl" in front of the script path?

I want to change this WITHOUT needing Admin Rights, as these are restricted on my computer.

I have even tried writing this in cmd:

assoc .pl=PerlScript
ftype PerlScript=C:\Perl520\Perl64\bin\perl.exe "%1" %*

Also here I keep getting the error message "Access is denied".

Is it possible to change the settings in another way?

EDIT: I managed to make it work through the first link. Yet I couldn't make it further after step 6 as once again I would need admin rights. At least I am now able to run a script by just typing Test.pl.

But when using an input file :Test.pl C:\input.txt I once again get an error message "Could not locate file!" When writing it like this, it works as usual:

C:\Perl520\Perl64\bin\perl.exe Test.pl C:\input.txt

Sheograph
  • 77
  • 4
  • Are you comfortable with the Windows Registry? If so, have a look inside the Registry for the change you made for "Open With". I think it's in a non-admin section of the Registry, probably HKCU. Then, see if you can modify those settings to do something like in my answer linked below. If you can mod your registry entry to do this, then you can export that registry key to a .REG script that others can use too, in case you need this for co-workers. https://stackoverflow.com/questions/705851/how-do-i-create-drag-and-drop-strawberry-perl-programs/706389#706389 – jimtut Aug 25 '21 at 20:29

1 Answers1

2

AFAIK, the file type association mechanism does require local admin rights. You can right-click on the script file and then pick perl.exe from the "Open With" menu, but that won't let you pass command line arguments to the string.

You might just want to run pl2bat on scripts you use often.

Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339