سؤال

I want to tweak my Windows 7 Ultimate OS to make it easier to open .php files on my server. If I just make the file open with iexplore.exe via the open with menu, it will attempt to download the .php file rather than opening it. (I use XAMPP).

I have configured the directories properly for XAMPP.

In the Reg I created

HKEY_CLASSES_ROOT\.php
@tweak.php.open

&

HKEY_CLASSES_ROOT\teak.php.open\shell\open\command
@"C:\Program Files (x86)\Internet Explorer\iexplore.exe" localhost/%1

However this does not produce the expected result. It does not work like this.

After some debugging I've found that the reason behind this is because the full address of the file is sent by using the variable %1.

i.e.

"C:\Program Files (x86)\Internet Explorer\iexplore.exe" localhost/D:\Web Development\xampp\htdocs\form.php

I thought the syntax was the same as in Batch? In batch if you use %1 it will be the name of the file. Which is what I want to get, not the entire path.

I've solved this matter with a rather choppy solution, by redirecting the output to a batch file I've created for parsing the string and sending it to iexplore.exe... Please somebody help me with the syntax or tell me where I can learn the proper syntax. (I'm not sure what the name of this type of language is called.... batch or shell or what. :S)

هل كانت مفيدة؟

المحلول

Try

@"C:\Program Files (x86)\Internet Explorer\iexplore.exe" "localhost/%~nx1"

P.S. No, i doesn't seem to work directly, you have to put this line into a batch file.

Here's the workaround, put this line into registry:

cmd /c "for %%a in ("%1") do "C:\Program Files (x86)\Internet Explorer\iexplore.exe" "localhost/%%~nxa""
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top