Re: Create a context menu entry doing runas

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thank you, Ramesh. the first suggest worked with one caveat.

Unfortunately the Perl script is on a networked drive that isn't
authenticated to the different userid. Consequently it is unavailable
until I run a "net use p: \\server\share" command. I got around this
by having the runas command execute a bat file that was local to my
PC. The bat file contains:

@net use p: \\app-nwss-001\cc_isoall
perl %1

which activates the P: drive and then executes the script. If the
script happens to be on the C: drive, no matter. The final command
that I put into the context menu item is:

runas.exe /user:nw\myuserid "cmd /k C:\Perl\bin\DKP_PERL.BAT %1" %*

Thank you for pointing me in the right direction.

"Ramesh, MS-MVP" <ramesh@xxxxxxxxxxxx> wrote in message
news:e4rb0$U8HHA.5316@xxxxxxxxxxxxxxxxxxxxxxx
Try:

runas.exe /user:nw\myuserid "cmd /k
C:\Perl\bin\perl.exe %1" %*

-or-

C:\Windows\system32\runas.exe /user:nw\myuserid "cmd /k
C:\Perl\bin\perl.exe %1" %*

-or-

%windir%\system32\runas.exe /user:nw\myuserid "cmd /k
C:\Perl\bin\perl.exe %1" %*
(In this case, make sure that the value type is REG_EXPAND_SZ, not
REG_SZ)

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows Shell/User]
Windows® Troubleshooting http://www.winhelponline.com


"bxb7668" <bxb7668@xxxxxxxxxxxxxxxx> wrote in message
news:%23t9vjOM8HHA.1204@xxxxxxxxxxxxxxxxxxxxxxx
I have a number of Perl scripts that I often have to execute as a
different userid. Up to now I open a command prompt and launch the
script using the runas command.

I would like to be able to add an item to the Windows context menu for
items with a .pl extension to automatically launch the script using
runas. I've created the menu entry as:

%windir%\system32\runas.exe /user:nw\myuserid "cmd /k
C:\Perl\bin\perl.exe %1" %*

This doesn't work. It gives me an error message of:

C:\cc_trigs\thescript.pl
Access is denied

If I right-click and select the default Open, the script runs just
fine.

Another problem with runas when I use it from the command line is that
it doesn't remember drives that I've already mapped. I'm guessing that
this is because the runas userid hasn't been authenticated. To get the
mapped drive to work I must use the "net use P: \\server\share"
command to make it available. I assume that to get the context menu to
work, the target Perl script must either be on my local drive or I
must include the "net use" command as part of the command string.

Can anyone help me with these issues?

Thank you
Brian



.



Relevant Pages

  • Re: Problem with one perl script executing another, execution started by Apache httpd
    ... perl script located in a directory tree completely outside the ... directory tree for IndigoPerl, as well as a system command (this is ... The second one just hangs, displaying the initial text, but the script ... What happens if you type this at the command ...
    (comp.lang.perl.misc)
  • Re: Kill processes after web page closes
    ... script and build a new web page based on input. ... If the user clicks the command button and is returned ... find the PERL script is still running. ... I'm not sure if this is exact but possible when user click back button then Appache server send TERM or QUIT signal to your perl proccess. ...
    (comp.lang.perl.misc)
  • Re: Create a context menu entry doing runas
    ... Unfortunately the Perl script is on a networked drive that isn't ... by having the runas command execute a bat file that was local to my ... it doesn't remember drives that I've already mapped. ... the target Perl script must either be on my local drive or I ...
    (microsoft.public.windowsxp.basics)
  • Re: Create a context menu entry doing runas
    ... Up to now I open a command prompt and launch the ... script using the runas command. ... it doesn't remember drives that I've already mapped. ...
    (microsoft.public.windowsxp.basics)
  • How to emulate this set or how to assign the result of running system "command" to a variable
    ... I currently have a MS-DOS batch file that am trying to convert to a Perl script. ... I have something like this in the .BAT file where variables are "set" based on ... rem creates a ftp command file on the root directory of the drive. ...
    (perl.beginners)