Opening file with spaces in Windows via Command Prompt
command-line, shell, windows-7
Solution
Just leave off `start`, and surround the full filename (including any path) with double-quotes. This works fine on my system:
C:\>"test space.avi"
Problem
I want to open a file (particularly video files) in its default program via script. When I come across a file name with spaces, it is taken as several arguments which was no surprise: ``` C:\folder>start test space.avi The system cannot find the file test. ``` However, when I surround the file name with quotes: ``` C:\folder>start "test space.avi" ``` instead of opening the file in its default program (VLC), a new Command Prompt window is opened up to the directory of the file. Opening a file without a space or quotes opens the file in VLC as expected. How can I get around this?