[英]Open file with spaces in filename using Ubuntu for Windows (WSL) - cmd.exe
我正在使用安裝了Ubuntu應用程序(WSL)的Windows 10 Fall Creator's Update(版本1703),該應用程序可以使用cmd.exe /C start ""
本地啟動Windows程序。
我的目標是使用文件的默認Windows應用程序在/mnt/d
打開文件。
多數情況下,它對我有用,但當我要打開帶有空格的文件名時除外。 在那種情況下,它只打開cmd.exe
窗口並在文件所屬的等效Windows目錄路徑中提示。 它不會在默認應用程序中打開文件。
舉例來說,如果我有文件courses.py
並a file name with spaces.py
中/mnt/d/files
cmd.exe /C start courses.py
courses.py
在VS Code中打開courses.py
。
cmd.exe /C start a\\ file\\ name\\ with\\ spaces.py
-在D:\\files
提示符下打開cmd.exe
我在WSL中錯誤地提供了文件名嗎?
@Compo在評論中提供了解決方案:
cmd.exe /C start "" "a\\ file\\ name\\ with\\ spaces.py"
由於我使用wsl-terminal ,因此通過使用以下簡潔的內置命令克服了這個問題:
cmdtool wstartex <file|url>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.