May 30, 200521 yr I have got this weird problem lately that I am unable to execute the batch file commands which have spaces in them. e.g.start /wait "c:\program files\Office\winword.exe"or start /wait "c:\my documents\my document with spaces.doc"In both cases either a new window is opened or the error message "cannot find c:\program" is shown! Any guess? Or may be I have screwed up some registry setting.My pc uses NTFS, RAID0, nlited Windows XP Pro.
May 31, 200521 yr This works for mePath="C:\Program Files\Microsoft Office\Office10"Start /Wait WINWORD.EXE
May 31, 200521 yr Saw few times this strange behavior - try this command:start /wait "Word" "c:\program files\Office\winword.exe"Is it working now?
May 31, 200521 yr You could leave the 'title' blank too and because 'Word' will already be in your path, also there should be no need for the extension because Windows will look for .exe anyhowstart "" /w winword
May 31, 200521 yr Thats true - everything defined in HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths can be run without path. Or of course everything in Path variable...
May 31, 200521 yr I had exactly the same problem with that. Use "%ProgramFiles%\Office\winword.exe" and "%UserProfile%\My Documents\my document with spaces.doc" and it should work.
May 31, 200521 yr Author Thanks all you guys, tried soulin's and Yzöwl's methods and they work just fine and relieved I am!Thanks again
May 31, 200521 yr Author @Marthax, using absolute paths like %programfiles% etc. doesn't help, you really have to put in quotes after /wait.
May 31, 200521 yr 2clavicle: I see your problem - it is taking strings between "" characters as Title - so the second "" is the command to execute.
May 31, 200521 yr Author Yes soulin!, your point is well taken and I have no problems now. All the batch files are working well. Thanks!
May 31, 200521 yr What would I had to write, if I have a command with spaces within an option, like del "c:\documents and settings\user\desktop\*" /Q /F?It seems, that the start /wait command doesn't like these addiotional quotas.I tried this start "" /wait "del "c:\documents and settings\user\desktop\*" /Q /F"How do I get this to run?
May 31, 200521 yr What would I had to write, if I have a command with spaces within an option, like del "c:\documents and settings\user\desktop\*" /Q /F?It seems, that the start /wait command doesn't like these addiotional quotas.I tried this start "" /wait "del "c:\documents and settings\user\desktop\*" /Q /F"How do I get this to run?<{POST_SNAPBACK}>Spaces are not the issue. Type Start /? at the prompt to see the syntax.del is an internal command, so it will be the same as calling cmd with a /k switch. I am not sure you want this?Using Delete directlyDel /f /q "c:\documents and settings\user\desktop\*"Or with Start. (same as cmd /k, so window stays open)Start "Title" Del /q /f "c:\documents and settings\user\desktop\*"
Create an account or sign in to comment