View Single Post
Old Mar 1st, 2005, 7:08 PM   #1
noleander
Newbie
 
Join Date: Mar 2005
Posts: 5
Rep Power: 0 noleander is on a distinguished road
How create variables to hold directory names on Windows?

I'm working on a PC running Windows XP. Using win-bash, but not CygWin. Having tremendous problems with spaces in folder names. Posted a question earlier today, and Ooble promptly replied with an excellent answer: Changing dirs works as long as you omit the drive ID:

bash> cd "C:\Program Files" # fails
bash> cd "\Program Files" # works

Thanks to Ooble. Next question: After typing "Program Files" the 40th time I'm thinking it is time to store the string "Program Files" in a string. I tried creating a variable and using it:

declare pf="\Program Files"
cd $pf

but this does not work because of the space in the folder name (it does work for folders without spaces in the name).

QUESTION: In bash on Windows, how can I store directory names (containing spaces) in variables so I can use them for "cd"?

Thanks in advance for any help,
neal
(unix programmer reluctantly shifting to PC)
noleander is offline   Reply With Quote