Run .url file

I am trying to open an app using a .url shortcut. I tried using the same method as for .lnk shorcuts but it's not valid. Anyone knows a workaround? Code:
Process proc = new Process();
Trace.WriteLine(MainDataModel.Default.FilePaths.ExecutableDirectory + "\\Minecraft Preview_Editor.url");
proc.StartInfo.FileName = MainDataModel.Default.FilePaths.ExecutableDirectory + "\\Minecraft Preview_Editor.url";
proc.Start();
Process proc = new Process();
Trace.WriteLine(MainDataModel.Default.FilePaths.ExecutableDirectory + "\\Minecraft Preview_Editor.url");
proc.StartInfo.FileName = MainDataModel.Default.FilePaths.ExecutableDirectory + "\\Minecraft Preview_Editor.url";
proc.Start();
BedrockLauncher.Exceptions.AppLaunchFailedException: An error occurred trying to start process 'C:\Users\<>\Documents\GitHub\BedrockLauncher\BedrockLauncher\bin\Debug\net6.0-windows10.0.17763.0\Minecraft Preview_Editor.url' with working directory 'C:\Users\<>\Documents\GitHub\BedrockLauncher\BedrockLauncher\bin\Debug\net6.0-windows10.0.17763.0'. The specified executable is not a valid application for this OS platform.
BedrockLauncher.Exceptions.AppLaunchFailedException: An error occurred trying to start process 'C:\Users\<>\Documents\GitHub\BedrockLauncher\BedrockLauncher\bin\Debug\net6.0-windows10.0.17763.0\Minecraft Preview_Editor.url' with working directory 'C:\Users\<>\Documents\GitHub\BedrockLauncher\BedrockLauncher\bin\Debug\net6.0-windows10.0.17763.0'. The specified executable is not a valid application for this OS platform.
7 Replies
Ⰽⰰⱈⰻⰽⱄ
.url file is just simple ini file, so only one thing you need to do is read that file and extract url from it [InternetShortcut] URL=http://www.someaddress.com/ WorkingDirectory=C:\WINDOWS\ ShowCommand=7 IconIndex=1 IconFile=C:\WINDOWS\SYSTEM\url.dll Modified=20F06BA06D07BD014D HotKey=1601 thats how it look when you open it in text editor There is unofficial documentation http://www.lyberty.com/encyc/articles/tech/dot_url_format_-_an_unofficial_guide.html
MetalManeMc
MetalManeMcOP2y ago
But how could I run a URL that opens an app? like with an adress minecraft:?Editor=true
MetalManeMc
MetalManeMcOP2y ago
Oh wait a second I found something on SO that works 🥳 https://stackoverflow.com/a/53245993/21437709
Stack Overflow
Process.Start to open an URL, getting an Exception?
I'm trying to open an URL following a simple method written all over google and even MSDN. But for unknown reasons I get an Exception as follows: Win32Exception was unhandled Message: Application ...
Ⰽⰰⱈⰻⰽⱄ
I'm not Windows expert, but there is some method in shell32.dll which allows you to run urls You can also try this
Ⰽⰰⱈⰻⰽⱄ
Quora
What is the equivalent of "xdg-open" on Windows?
Answer (1 of 3): You can use 'start' command. it will open the file with default windows environment. Suppose you have a file test.txt, which by default opens in notepad++. just enter command start .\test.txt. It will launch notepad++ with this file open.
Ⰽⰰⱈⰻⰽⱄ
You can execute commands like "start" with Process.Start
MetalManeMc
MetalManeMcOP2y ago
Yeah that's what the comment says, thanks 🙃
Want results from more Discord servers?
Add your server