Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading a file through command prompt  RSS feed

 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I want to read a file that I give through the command prompt. I want to know how I can avoid blank spaces so that I can get to the file. For example, I have a file located at c:\Documents and settings\User\file.txt. I want to read the file.txt, but when I supply this as command line argument, due to the white space after Documents, I'm not able to read the file. Any suggestions on how to do this?
 
Joe Ess
Bartender
Posts: 9425
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Enclose the path in quotes.
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did that, but there is some other program that will generate the path for me. So I have to make some minor modifications to the other program such that it gives the path with double quotes. I've pasted the entire program that I tried in my other post here.

Thanks for the help!
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did that, but there is some other program that will generate the path for me. So I have to make some minor modifications to the other program such that it gives the path with double quotes. I've pasted the entire program that I tried in my other post here.

Thanks for the help!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!