简体   繁体   English

在Windows 10的Ubuntu Bash shell中,如何使用默认程序打开文件或目录?

[英]In the Ubuntu Bash shell in Windows 10, how do you open a file or directory with the default program?

Eg, if I have .java files set to open with Notepad++, is there some command I can run like open ./Blah.java that will open Blah.java in Notepad++, or open . 例如,如果我将.java文件设置为使用Notepad ++打开,是否有一些命令我可以像open ./Blah.java一样运行,它将在Notepad ++中打开Blah.java,或者open . to open the current directory in Explorer? 在资源管理器中打开当前目录? On Mac OS X, open is this command. 在Mac OS X上, open是此命令。

You need something that wraps the ShellExecute function . 你需要一些包装ShellExecute函数的东西。

With Cygwin, this is cygstart . 有了Cygwin,这就是cygstart

With PowerShell, this is Start-Process . 使用PowerShell,这是Start-Process

You can run PowerShell from the Bash shell, but it is not ideal: 您可以从Bash shell运行PowerShell,但它并不理想:

powershell Start-Process Blah.java

This is currently a feature request for Ubuntu on Windows. 这是目前Windows上Ubuntu的功能请求

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Bash Ubuntu中的Windows 10 Open Directory - Windows 10 Open Directory in Bash Ubuntu 使用 bash shell 在 Windows 10 上打开默认应用程序 - Open default app on windows 10 using bash shell Windows 10 Ubuntu Shell中的Bash脚本 - Bash Scripts in the Windows 10 Ubuntu Shell 如何使用 Windows 终端 Ubuntu 打开 .sh 或 .bash 文件? - How do you make .sh or .bash files open with Windows Terminal Ubuntu? 如何在 Windows 10 上使用“npm start”打开您想要的默认浏览器 - How to open the browser that you want as default with "npm start" on Windows 10 如何从Windows任务调度程序上运行(ubuntu bash windows 10)程序 - How to run program on ( ubuntu bash windows 10 ) from windows task scheduler 如何在Windows 10环境中从Java运行在Ubuntu上用Bash编写的Shell脚本? - How can I run a shell script, written in Bash on Ubuntu, from Java in a Windows 10 environment? 如何在 Windows 10 64 位上默认打开 .jar 文件 - How to open a .jar file by default on windows 10 64 bit 在Linux的Windows子系统(Windows上为Ubuntu上的WSL / Bash)中,如何将颜色重置为默认/原始方案? - In the Windows Subsystem for Linux (WSL / Bash on Ubuntu on Windows) how do I reset the colors to the default/original scheme? 如何检查程序是否运行在 Bash Ubuntu Windows 而不仅仅是普通的 Ubuntu? - How to check if a program is run in Bash on Ubuntu on Windows and not just plain Ubuntu?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM