Overclock.net › Forums › Software, Programming and Coding › Operating Systems › How to deal with file names that have spaces in Command Prompt
New Posts  All Forums:Forum Nav:

How to deal with file names that have spaces in Command Prompt  

post #1 of 18
Thread Starter 
How do you manupulate files in the Windows Command prompt that have a space in them? Say I want to run "this program.exe". Typing in this program.exe will not work.
System
(13 items)
 
  
CPUMotherboardGraphicsRAM
Core i7 2500k ASRock P67 Extreme4 Gen 3 AMD 7970 16GB DDR3 
Hard DriveOptical DriveOSMonitor
Intel 520 256GB SATA DVD Burner Windows 7 64 bit Deal U2410 
KeyboardPowerMouse
Adesso Mechanical Silverstone OP650 Logitech G700 
  hide details  
System
(13 items)
 
  
CPUMotherboardGraphicsRAM
Core i7 2500k ASRock P67 Extreme4 Gen 3 AMD 7970 16GB DDR3 
Hard DriveOptical DriveOSMonitor
Intel 520 256GB SATA DVD Burner Windows 7 64 bit Deal U2410 
KeyboardPowerMouse
Adesso Mechanical Silverstone OP650 Logitech G700 
  hide details  
post #2 of 18
Quote:
Originally Posted by pauldovi View Post
How do you manupulate files in the Windows Command prompt that have a space in them? Say I want to run "this program.exe". Typing in this program.exe will not work.
I don't really know cuz I haven't ever tried but did you try using % as a space?
Mini Beast
(13 items)
 
  
CPUMotherboardGraphicsRAM
core I5 2310 Asrock Z77-E ITX Asus 6850 DirectCU 1GB 2x4GB Corsair Vengeance LP 
Hard DriveHard DriveOSMonitor
128GB Kingston SSDNOW SATAIII Seagate 7200RPM 500GB SATAII Windows 7 Home Premium Sony Bravia NX720 46" 
KeyboardPowerCaseMouse
Microsoft Standard Keyboard 450w Silverstone SFX Silverstone SUGO SG05BB Microsoft Sidewinder X5 
Audio
Creative Labs Omega Tactic 3d 
  hide details  
Mini Beast
(13 items)
 
  
CPUMotherboardGraphicsRAM
core I5 2310 Asrock Z77-E ITX Asus 6850 DirectCU 1GB 2x4GB Corsair Vengeance LP 
Hard DriveHard DriveOSMonitor
128GB Kingston SSDNOW SATAIII Seagate 7200RPM 500GB SATAII Windows 7 Home Premium Sony Bravia NX720 46" 
KeyboardPowerCaseMouse
Microsoft Standard Keyboard 450w Silverstone SFX Silverstone SUGO SG05BB Microsoft Sidewinder X5 
Audio
Creative Labs Omega Tactic 3d 
  hide details  
post #3 of 18
Spaces do work in command prompt as far as I have have ever used them. What is is you are trying to do?
My System
(17 items)
 
  
CPUMotherboardGraphicsGraphics
AMD Phenom II X4 955  Gigabyte GA-MA790XT-UD4P Sapphire HD 6950 Sapphire HD 6950 
RAMHard DriveHard DriveOptical Drive
G-Skill Mushkin Callisto Deluxe WD Black LG Supermulti 
CoolingOSKeyboardPower
Rasa Black CPU water block. Rasa X20 pump/res c... Windows 7 Ultimate x64 Deck Legend Fire mechanical with Cherry Black s... Cooler Master Silent Pro Gold 1200W modular PSU. 
CaseMouseAudio
Cooler Master Storm Scout Logitech MX-518 Logitech Wireless headset for gaming and 100w M... 
  hide details  
My System
(17 items)
 
  
CPUMotherboardGraphicsGraphics
AMD Phenom II X4 955  Gigabyte GA-MA790XT-UD4P Sapphire HD 6950 Sapphire HD 6950 
RAMHard DriveHard DriveOptical Drive
G-Skill Mushkin Callisto Deluxe WD Black LG Supermulti 
CoolingOSKeyboardPower
Rasa Black CPU water block. Rasa X20 pump/res c... Windows 7 Ultimate x64 Deck Legend Fire mechanical with Cherry Black s... Cooler Master Silent Pro Gold 1200W modular PSU. 
CaseMouseAudio
Cooler Master Storm Scout Logitech MX-518 Logitech Wireless headset for gaming and 100w M... 
  hide details  
post #4 of 18
Thread Starter 
Well Windows allows for spaces... so it should be able to manipulate them.

I am using Windows Server 2008 Core, and there is no GUI.
System
(13 items)
 
  
CPUMotherboardGraphicsRAM
Core i7 2500k ASRock P67 Extreme4 Gen 3 AMD 7970 16GB DDR3 
Hard DriveOptical DriveOSMonitor
Intel 520 256GB SATA DVD Burner Windows 7 64 bit Deal U2410 
KeyboardPowerMouse
Adesso Mechanical Silverstone OP650 Logitech G700 
  hide details  
System
(13 items)
 
  
CPUMotherboardGraphicsRAM
Core i7 2500k ASRock P67 Extreme4 Gen 3 AMD 7970 16GB DDR3 
Hard DriveOptical DriveOSMonitor
Intel 520 256GB SATA DVD Burner Windows 7 64 bit Deal U2410 
KeyboardPowerMouse
Adesso Mechanical Silverstone OP650 Logitech G700 
  hide details  
post #5 of 18
In Linux you use a \\ in front of the space, but not sure about windows. I always thought windows just handled the spaces. Never really ran into the problem I guess.
post #6 of 18
Put the file name in quotes. This should also work for complete file paths too.

"like this.exe"
"c:\\my folder\\like this.exe"
     
CPUMotherboardGraphicsRAM
Q9450 @ 3.0 Gigabyte GA-P45-UD3P Evga 9800GTX+ 800/1943/1200 2x2GB OCZ 1066 LV 
Hard DriveOptical DriveOSMonitor
Vertex 2 40gb + 750gb Seagate 7200.10 Lite-On 24x DVD+-RW Windows 7 x64 LG 22" 1680x1050 
PowerCase
Corsair HX520w modular Coolermaster CM-690 
CPUMotherboardRAMHard Drive
Sempron LE-1250 Gigabyte GA-MA78GPM-DS2H 2GB (2x1GB) Corsair Ballistix 1066 2x750GB Western Digital RE2 Green power 
OSPowerCase
Windows Home Server w/ PP3 Ultra 400w modular Antec 300 
  hide details  
     
CPUMotherboardGraphicsRAM
Q9450 @ 3.0 Gigabyte GA-P45-UD3P Evga 9800GTX+ 800/1943/1200 2x2GB OCZ 1066 LV 
Hard DriveOptical DriveOSMonitor
Vertex 2 40gb + 750gb Seagate 7200.10 Lite-On 24x DVD+-RW Windows 7 x64 LG 22" 1680x1050 
PowerCase
Corsair HX520w modular Coolermaster CM-690 
CPUMotherboardRAMHard Drive
Sempron LE-1250 Gigabyte GA-MA78GPM-DS2H 2GB (2x1GB) Corsair Ballistix 1066 2x750GB Western Digital RE2 Green power 
OSPowerCase
Windows Home Server w/ PP3 Ultra 400w modular Antec 300 
  hide details  
post #7 of 18
spaces work just fine in my windows comand prompt for loading up a program that's like pro gram.exe
quad core madness
(14 items)
 
  
CPUMotherboardGraphicsRAM
Lapped Intel Core 2 Quad - Q6600 G0 Stepping Asus P5K Deluxe WiFi ATi Sapphire HD 6950 2GB Unlocked 8GB G.Skill Pi Black DDR2-800 PC2-6400 
Hard DriveOptical DriveOSMonitor
60GB OCZ Solid 2 SSD Samsung SATA 18X DVD Burner Windows 7 Ultimate x64 Dell 3007WFP-HC + 2x 2007FP in PLP 
KeyboardPowerCaseMouse
Ducky Shine Blue, MX Red Corsair HX620 620W Lian Li V1000 Plus Black Razer Mamba 2012 
Mouse PadAudio
XTrack Ripper XL Creative X-Fi XtremeMusic 
  hide details  
quad core madness
(14 items)
 
  
CPUMotherboardGraphicsRAM
Lapped Intel Core 2 Quad - Q6600 G0 Stepping Asus P5K Deluxe WiFi ATi Sapphire HD 6950 2GB Unlocked 8GB G.Skill Pi Black DDR2-800 PC2-6400 
Hard DriveOptical DriveOSMonitor
60GB OCZ Solid 2 SSD Samsung SATA 18X DVD Burner Windows 7 Ultimate x64 Dell 3007WFP-HC + 2x 2007FP in PLP 
KeyboardPowerCaseMouse
Ducky Shine Blue, MX Red Corsair HX620 620W Lian Li V1000 Plus Black Razer Mamba 2012 
Mouse PadAudio
XTrack Ripper XL Creative X-Fi XtremeMusic 
  hide details  
post #8 of 18
Quote:
Originally Posted by e_dogg View Post
Put the file name in quotes. This should also work for complete file paths too.

"like this.exe"
"c:my folderlike this.exe"
This has always worked for me, as well.
morpheus
(17 items)
 
smith
(6 items)
 
 
CPUMotherboardGraphicsRAM
Core i5 2400 GIGABYTE GA-H67MA-UD2H-B3 XFX Radeon 7850 Double D G.Skill Ripjaw X 
Hard DriveHard DriveCoolingOS
OCZ Vertex 3 Western Digital 640gb AAKS Zalman VF900 Windows 7 Ultimate x64 
MonitorKeyboardPowerCase
Dell UltraSharp U2412M OCN Ducky 9004 FSP Group FSP450-60GHS(85)-R InWin Dragon Slayer mATX 
MouseAudioAudio
Logitech G5 Digidesign MBox 2 Fiio E7 
CPUMotherboardGraphicsHard Drive
i5-3210m Lenovo X230 Intel HD 4000 Samsung SSD 
OSMonitor
Windows 7 12.5" IPS LED Backlit Panel, 1366x768 
  hide details  
morpheus
(17 items)
 
smith
(6 items)
 
 
CPUMotherboardGraphicsRAM
Core i5 2400 GIGABYTE GA-H67MA-UD2H-B3 XFX Radeon 7850 Double D G.Skill Ripjaw X 
Hard DriveHard DriveCoolingOS
OCZ Vertex 3 Western Digital 640gb AAKS Zalman VF900 Windows 7 Ultimate x64 
MonitorKeyboardPowerCase
Dell UltraSharp U2412M OCN Ducky 9004 FSP Group FSP450-60GHS(85)-R InWin Dragon Slayer mATX 
MouseAudioAudio
Logitech G5 Digidesign MBox 2 Fiio E7 
CPUMotherboardGraphicsHard Drive
i5-3210m Lenovo X230 Intel HD 4000 Samsung SSD 
OSMonitor
Windows 7 12.5" IPS LED Backlit Panel, 1366x768 
  hide details  
post #9 of 18
I know that in html %20 is the code for space. I don't know though if that workd in cmd.
ChemX1200
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Q6700 @ 3.6Ghz DFI UT X48 T2R VisionTek HD4870 OCZ Titanium DDR800 (2x 2Gb) 
Hard DriveOptical DriveOSMonitor
3x WD RE3 500Gb RAID0 On Areca1210 1x Pioneer BD-RW 1x Asus DVD-RW Lightscribe Windows 7 Ultimate X64 Dell 24" G2410 LED LCD 
KeyboardPowerCaseMouse
Unicomp Customizer 104 Corsair 850W Mod. Cables Antec 1200 Logitech Performance MX 
  hide details  
ChemX1200
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Q6700 @ 3.6Ghz DFI UT X48 T2R VisionTek HD4870 OCZ Titanium DDR800 (2x 2Gb) 
Hard DriveOptical DriveOSMonitor
3x WD RE3 500Gb RAID0 On Areca1210 1x Pioneer BD-RW 1x Asus DVD-RW Lightscribe Windows 7 Ultimate X64 Dell 24" G2410 LED LCD 
KeyboardPowerCaseMouse
Unicomp Customizer 104 Corsair 850W Mod. Cables Antec 1200 Logitech Performance MX 
  hide details  
post #10 of 18
%20 does nothing, because as you said, it's HTML. It only works in browsers.

The correct method would be quotes or escaping each space. Command prompt will do this for you if you start typing it out, then hit tab. It'll auto-complete the rest of the name, with quotes or escaped characters if necessary.
Romdeau
(13 items)
 
  
CPUMotherboardGraphicsRAM
C2D E6700 Asus P5B Deluxe Geforce 8800GTS 320MB 2GB 
Hard DriveOptical DriveOSMonitor
40GB, 120GB, 160GB SATA, 250GB SATA Lite-On DVD Burner Vista 32-bit Home Premium Viewsonic 19" WS LCD, Viewsonic 17" 4:3 LCD 
KeyboardPowerCaseMouse
Logitech G11 Seasonic 550W Antec w/ window (OLD STEEL BEAST) Logitech MX518 
Mouse Pad
Old cloth/rubber pad with Riven artwork 
  hide details  
Romdeau
(13 items)
 
  
CPUMotherboardGraphicsRAM
C2D E6700 Asus P5B Deluxe Geforce 8800GTS 320MB 2GB 
Hard DriveOptical DriveOSMonitor
40GB, 120GB, 160GB SATA, 250GB SATA Lite-On DVD Burner Vista 32-bit Home Premium Viewsonic 19" WS LCD, Viewsonic 17" 4:3 LCD 
KeyboardPowerCaseMouse
Logitech G11 Seasonic 550W Antec w/ window (OLD STEEL BEAST) Logitech MX518 
Mouse Pad
Old cloth/rubber pad with Riven artwork 
  hide details  
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Operating Systems
This thread is locked  
Overclock.net › Forums › Software, Programming and Coding › Operating Systems › How to deal with file names that have spaces in Command Prompt