3
1
In Computer\HKEY_CLASSES_ROOT\Directory\shell
and Computer\HKEY_CLASSES_ROOT\Directory\Background\shell
I have created the Primary Key "Serve Directory". Then added the "command" key under this primary key, which contains "C:\Users\assylum\Documents\_Scripts\ruby_webserver.cmd" "%1"
as the Default
entry. The content of this batch file is ruby -run -e httpd %1 -b 127.0.0.1 -p 4000
.
Here is an image to explain this better:
When I right click on a folder, this works fine. However, if I right click into the white space of a folder and choose the command, I get this error message:
What is my mistake here?
If you switch it to a program like notepad does it work? – Ramhound – 2017-04-13T12:48:37.590
1@Ramhound Yes, it does. However, same command works when right-clicking a folder too. It is just the "global" entry that causes issues. Prepending it with
cmd.exe /C
does not help either. – BadSnowflake – 2017-04-13T12:49:37.870Just a guess, but perhaps try relocating "ruby_webserver.cmd" (etc.) to someplace outside of your user folder, to a folder that all users can access, and try it again? – Ƭᴇcʜιᴇ007 – 2017-04-13T12:53:09.850
@Ƭᴇcʜιᴇ007 Moved it to
C:\Tools
edited both entries, same difference. – BadSnowflake – 2017-04-13T12:57:12.963I would suggest the next thing to check is if Explorer is puking when it tries to the
ruby_webserver.cmd
file, or if it's when it tries to run a command within the .cmd file. Perhaps test by replacingruby_webserver.cmd
with another .cmd that simply echoes something to a file, or alike? If that works as expected, then it's probably something in the .cmd that need sot be looked at next. – Ƭᴇcʜιᴇ007 – 2017-04-13T13:01:35.547As I said, the batch file works when I right click a folder. Here is a video: https://streamable.com/m2t9s The Ruby bin directory is in the path for all users, so Windows should find it no problem. Also, the command window should still open for a second, if it cannot find the command in the batch file.
– BadSnowflake – 2017-04-13T13:03:16.140@Ƭᴇcʜιᴇ007 I added
echo Test > file.txt
as a first line, the file does not show up when reproducing the issue, so Windows somehow does not know how to launch a .cmd file, even though the ending is in thePATHEXT
variable. – BadSnowflake – 2017-04-13T13:07:52.393Does it happen to work if you use a
.bat
instead? – Ƭᴇcʜιᴇ007 – 2017-04-13T13:11:36.547@Ƭᴇcʜιᴇ007 Same thing. Also changing it to
"C:\Windows\System32\cmd.exe" /C "C:\tools\ruby_webserver.cmd" "%1"
does not work either. – BadSnowflake – 2017-04-13T13:13:43.530