absolutebeginner
 New Member Posts:14

 |
| 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 Levy PowerShell MVP, Admin
 Veteran Member Posts:1362

 |
| 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 |
|
|
absolutebeginner
 New Member Posts:14

 |
| 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. |
|
|
|
|
absolutebeginner
 New Member Posts:14

 |
| 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 Levy PowerShell MVP, Admin
 Veteran Member Posts:1362

 |
|
absolutebeginner
 New Member Posts:14

 |
| 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 Levy PowerShell MVP, Admin
 Veteran Member Posts:1362

 |
|
absolutebeginner
 New Member Posts:14

 |
| 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! |
|
|
|
|
neephius
 New Member Posts:2

 |
| 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. |
|
|
|
|
neephius
 New Member Posts:2

 |
| 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. |
|
|
|
|