1
I did try this test.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations\audio\shell\ChunkAudio]@="chunk audio (5 min)""Icon"="%SystemRoot%\\System32\\shell32.dll,186"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations\audio\shell\ChunkAudio\Command]@="%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe C:\Users\Me\Desktop\5min_chunk_audio.ps1 %1"
It adds a context menu on the audio files as expected, but it sends an error when I click on it:
Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item.
It might be because the test.reg doesn't add anything to the field "Data" in ....shell\ChunkAudio\Command in the registry. (I tried to manualy add the %SystemRoot%\system32\... C:\...audio.ps1 %1
)
I also tried:
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations\audio\shell\ChunkAudio\Command]
@="CMD.EXE /C Powershell.exe -File C:\\Users\\Me\Desktop\\petit_program\\PowerShell\\PowerShell_script\\5min_chunk_audio.ps1 %1"
It works, but it's weird that to run the powershell you need first to run the cmd to launch it (if i understand your code correctly) – J. Does – 2018-12-27T14:55:11.167
And is there a way to run it silently on the background? (Without the cmd windows?) – J. Does – 2018-12-27T14:56:30.193
1
You may try it without CMD and it might even work. But with CMD you can also use this answer.
– harrymc – 2018-12-27T15:03:26.210if you get an error
Cannot process argument because the value of argument "name" is not valid. Change the value of the "name" etc.
it's because of the space isinde the selected file name. – J. Does – 2018-12-27T20:54:58.320by the way it also works without the CMD.EXE /C (and re-by the way: use /k instead if you want the cmd windows to stay open) – J. Does – 2018-12-28T08:43:04.513