Home > Backend Development > Golang > Open txt file using default windows text editor in golang

Open txt file using default windows text editor in golang

WBOY
Release: 2024-02-06 11:27:13
forward
559 people have browsed it

Open txt file using default windows text editor in golang

Question content

I want to open a txt file using the set default text editor application, but I don't know where Windows stores applications and files Format association. For example, in Unix-like systems, there is a command variable called $EDITOR that stores the path to the default editor.

I did a lot of research but didn't find anything

Thanks in Advance


Correct Answer


I figured out how to open a file in windows using the default application. All you need to do is open the file yourself. Take a look at the example below.

exec.Command("cmd", "/c", "sample.txt")
Copy after login

The above is the detailed content of Open txt file using default windows text editor in golang. For more information, please follow other related articles on the PHP Chinese website!

source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template