How to use a PowerShell Script in the Windows "SendTo" folder?
There are instructions on how to use a bash script in the SendTo folder (using the instructions in the below link). However, I would like to execute a PowerShell script instead.
Is it possible to use a shell script in the sendto folder
I would like for the shortcut to execute a PowerShell function that I have defined in my PowerShell profile called, Invoke-SendToUPLOAD... where Invoke-SendToUPLOAD accepts the full file path of the sendto file as a parameter by default.
I "almost" have what I want. However, filepaths that have spaces in them are truncated. Could someone tell me how to preserve the filepath even if there's a space in the path. I've tried putting double-quotes around %1 below. However, that doesn't work either.
C:\Windows\System32\cmd.exe /c start /min cmd.exe /c PowerShell.exe -Command "& {param ($I = {%1} ); Invoke-SendToUPLOAD }"
Solution 1:
There was a solution on StackOverflow for this: https://stackoverflow.com/a/15934981/651934
In short, surround the parameter with single quotes. In your case, the following should work:
C:\Windows\System32\cmd.exe /c start /min cmd.exe /c PowerShell.exe -Command "& {param ($I = {'%1'} ); Invoke-SendToUPLOAD }"
The downside is that this doesn't support filenames that contain a single quote. But spaces and other characters work fine.