header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
PS Script in SendTo context menu - howto?
Last Post 14 Jun 2011 08:24 PM by neephius. 9 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
absolutebeginnerUser is Offline
New Member
New Member
Posts:14
Avatar

--
26 Jul 2010 10:23 AM
    Hello, I wonder if there is a way to have PS scripts in the Windows-Explorer SendTo context menu. I do have some batch files in the SendTo folder but .ps1 files (or links to them) put there don't show up in the menu. Is there a way to get this working? I'm using Windows 7. Alternatively, is there any way that I right click on a file and the files FullName gets passed to a PS script as a variable? Thanks
    Shay LevyUser is Offline
    PowerShell MVP, Admin
    Veteran Member
    Veteran Member
    Posts:1362
    Avatar

    --
    27 Jul 2010 06:41 AM
    Create a shortcut to powershell.exe in the sendto folder, then right click a ps1 file > sendto > windows powershell. Yyou may want to modify the shortcut and add the -noexit switch to leave the shell open.

    Shay Levy
    Windows PowerShell MVP
    http://PowerShay.com
    PowerShell Community Toolbar
    Twitter: @ShayLevy
    absolutebeginnerUser is Offline
    New Member
    New Member
    Posts:14
    Avatar

    --
    27 Jul 2010 12:15 PM
    Thanks for your reply, though it was not exactly what I was after. I found a solution myself: I made a .bat file which I put in the SendTo folder. Content: powershell myscript.ps1 %1. When I right-click > SendTo the .bat on a file, it starts my script whith the FullName of the file as $arg.
    absolutebeginnerUser is Offline
    New Member
    New Member
    Posts:14
    Avatar

    --
    27 Jul 2010 12:15 PM
    Thanks for your reply, though it was not exactly what I was after. I found a solution myself: I made a .bat file which I put in the SendTo folder. Content: powershell myscript.ps1 %1. When I right-click > SendTo the .bat on a file, it starts my script whith the FullName of the file as $arg.
    Shay LevyUser is Offline
    PowerShell MVP, Admin
    Veteran Member
    Veteran Member
    Posts:1362
    Avatar

    --
    28 Jul 2010 01:21 AM
    May I ask why aren't you sending the script directly to the PowerShell shortcut? What benefit you get by using the batch file?

    Shay Levy
    Windows PowerShell MVP
    http://PowerShay.com
    PowerShell Community Toolbar
    Twitter: @ShayLevy
    absolutebeginnerUser is Offline
    New Member
    New Member
    Posts:14
    Avatar

    --
    28 Jul 2010 06:18 AM
    I've made a small script to add GPS Exif-Infos to my pictures (using Exiftool). I right-click e.g. on a jpeg > SendTo > MyGPSScript.bat. Then the .bat starts the script which queries Longitude, Latidude, DaylightSavingTime etc. First I thought I would be only able to click on .ps1 files with your tipp but now reconsidered :). Anyways, I didn't get this to work whith a direct link to pwoershell.exe. This is what I entered into the links destination: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe exifgps.ps1 %1 -noexit Do you know what I have to enter there that it works directly with the Powershell link? The way I currently do it with the batch file is a bit "laggy" - always takes a small moment when Powershell starts in the command prompt. Thanks!
    Shay LevyUser is Offline
    PowerShell MVP, Admin
    Veteran Member
    Veteran Member
    Posts:1362
    Avatar

    --
    29 Jul 2010 02:21 AM
    Makes sense, sending a jpeg directly to powershell.exe will not work.

    Shay Levy
    Windows PowerShell MVP
    http://PowerShay.com
    PowerShell Community Toolbar
    Twitter: @ShayLevy
    absolutebeginnerUser is Offline
    New Member
    New Member
    Posts:14
    Avatar

    --
    29 Jul 2010 03:07 AM
    Works now. The -noexit has to be right after powershell.exe and the %1 is not necessary.C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit exifgps.
    Thanks again!
    neephiusUser is Offline
    New Member
    New Member
    Posts:2
    Avatar

    --
    14 Jun 2011 08:23 PM
    here is a command for the sendto context menu in windows 7. open run and type or paste this in press enter and you can add all the shortcots from here as in send this document or files to it shortcut destination.

    (%APPDATA%\Microsoft\Windows\SendTo) without brackets.
    neephiusUser is Offline
    New Member
    New Member
    Posts:2
    Avatar

    --
    14 Jun 2011 08:24 PM
    here is a command for the sendto context menu in windows 7. open run and type or paste this in press enter and you can add all the shortcots from here as in send this document or files to it shortcut destination.

    (%APPDATA%\Microsoft\Windows\SendTo) without brackets.
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer