clavicle Posted May 30, 2005 Posted May 30, 2005 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.
MHz Posted May 31, 2005 Posted May 31, 2005 This works for mePath="C:\Program Files\Microsoft Office\Office10"Start /Wait WINWORD.EXE
Martin Zugec Posted May 31, 2005 Posted May 31, 2005 Saw few times this strange behavior - try this command:start /wait "Word" "c:\program files\Office\winword.exe"Is it working now?
Yzöwl Posted May 31, 2005 Posted May 31, 2005 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
Martin Zugec Posted May 31, 2005 Posted May 31, 2005 Thats true - everything defined in HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths can be run without path. Or of course everything in Path variable...
Marthax Posted May 31, 2005 Posted May 31, 2005 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.
clavicle Posted May 31, 2005 Author Posted May 31, 2005 Thanks all you guys, tried soulin's and Yzöwl's methods and they work just fine and relieved I am!Thanks again
clavicle Posted May 31, 2005 Author Posted May 31, 2005 @Marthax, using absolute paths like %programfiles% etc. doesn't help, you really have to put in quotes after /wait.
Martin Zugec Posted May 31, 2005 Posted May 31, 2005 2clavicle: I see your problem - it is taking strings between "" characters as Title - so the second "" is the command to execute.
clavicle Posted May 31, 2005 Author Posted May 31, 2005 Yes soulin!, your point is well taken and I have no problems now. All the batch files are working well. Thanks!
Doc Symbiosis Posted May 31, 2005 Posted May 31, 2005 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?
MHz Posted May 31, 2005 Posted May 31, 2005 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\*"
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now