Pages: [1]   Go Down
  Print  
Author Topic: A Stupid Windows Basics Question  (Read 4828 times)
0 Members and 1 Guest are viewing this topic.
Tom
Administrator
Senior Member
*
Offline Offline

Posts: 5,618



View Profile WWW
« on: February 18, 2005, 02:03:05 PM »

I have a question that's haunted me since Win95 first came out; one that I'm sure everyone here will have the answer to...except for me.   Sad

The Program Files directory:

When I access the Program Files directory from a DOS or command prompt, it shows up as:  "C:\Program Files"  But in order to enter that directory, I type "cd progra~1".  (Typing "cd Program Files" doesn't get me there.)  So, when I need to place the absolute path of a program into an ini or batch file, I never know the proper way to do this ... if the program is located somewhere under the Program Files directory.

For example, what's the absolute path syntax to "myprogram.exe" in this scenerio?  Is it:

c:\Program Files\utility\myprogram.exe

-- or --

c:\progra~1\utility\myprogram.exe


The DOS or Command prompt seems to like the eight-character limit for manual navigation, but doesn't display that limitation.
Logged

Kaminari
Senior Member
*
Offline Offline

Posts: 149



View Profile WWW
« Reply #1 on: February 18, 2005, 04:30:20 PM »

I seem to recall that under DOS 7 (Win95) and possibly DOS 6, file names are not limited to eight characters anymore (maybe 32 or something like that). The key point here is that you need to embed your command into a "double quote", say:

cd "program files"

In your example, the absolute path would be

"c:\program files\utility\myprogram.exe"

At least that's the way it works with the DOS shell of WinXP and Win2K (though it's only a DOS emulation, not a real DOS environment), and I'm almost sure it works the same under Win9x. I'd check it myself but my main rig is busted at the moment.
Logged
Tom
Administrator
Senior Member
*
Offline Offline

Posts: 5,618



View Profile WWW
« Reply #2 on: February 18, 2005, 04:38:41 PM »

Got it.  So...if a situation already calls for the absolute path to be in quotes, like in your example, you can keep that space between the words PORGRAM and FILES.  Interesting.
Logged

Tom
Administrator
Senior Member
*
Offline Offline

Posts: 5,618



View Profile WWW
« Reply #3 on: February 18, 2005, 05:02:31 PM »

Hmmmm....actually, this doesn't work for me on XP Pro, using the "quotes", that is.  TOO MANY PARAMETERS.  Works fine on Win98, though.  Does this have anything to do with the NTFS format?  I seem to only be able to use cd progra~1 to get into the Program Files directory.
Logged

Zemus
Senior Member
*
Offline Offline

Posts: 1,366


View Profile WWW
« Reply #4 on: February 18, 2005, 06:02:51 PM »

That's weird. I can use "cd program files" as well as "cd progra~1" to get into the program files directory. I can also use "cd "program files"". All Windows programs nowadays should be able to understand a space in a directory name. The program should put "" around the directory name if it needs it.
Logged
Tom
Administrator
Senior Member
*
Offline Offline

Posts: 5,618



View Profile WWW
« Reply #5 on: February 18, 2005, 09:05:48 PM »

I'm at work now, and none of these Win NT or XP Pro PC's will allow the "quotes" for    cd "Program Files".  Must be a NT thing.  (XP Pro is the latest version of NT, isn't it?)
Logged

Zemus
Senior Member
*
Offline Offline

Posts: 1,366


View Profile WWW
« Reply #6 on: February 18, 2005, 09:23:48 PM »

I also use Windows XP Pro.
Logged
QBiN
Member
*
Offline Offline

Posts: 44


View Profile
« Reply #7 on: February 18, 2005, 09:34:46 PM »

Quote from: Tom
I'm at work now, and none of these Win NT or XP Pro PC's will allow the "quotes" for    cd "Program Files".  Must be a NT thing.  (XP Pro is the latest version of NT, isn't it?)


For the sake of just browsing your drive, hitting the <Tab> key will auto-complete your cd command as long as you've typed enough for your entry to be unique.



Also, for me at least, using quotes around the entire path works for refencing the full NTFS path as seen in the quotes around the paths in the example below. It's a shortcut on my C root directory pointing to a file on my desktop.



Hope that helps.
Logged
Tom
Administrator
Senior Member
*
Offline Offline

Posts: 5,618



View Profile WWW
« Reply #8 on: February 18, 2005, 10:05:06 PM »

Hmmm.  That's not working with any of these NT and XP Pro PC's.  Is this something you've setup in Windows?
Logged

QBiN
Member
*
Offline Offline

Posts: 44


View Profile
« Reply #9 on: February 18, 2005, 11:16:48 PM »

Can't say that I've done anything special to my WinXP Pro. I also tried it when I got home just a moment ago, and it works here too.

Only difference between my home and work is I have SP2 at home, and SP1a at work. Both work.

I can't imagine why it wouldn't work for you, Tom. That's just bizarre.
Logged
Tom
Administrator
Senior Member
*
Offline Offline

Posts: 5,618



View Profile WWW
« Reply #10 on: February 18, 2005, 11:34:56 PM »

Okay, here's what I'm doing.  (I'm on a XP Pro PC at the moment...)

I type:

cd "Program Files"

Command responds with:

parameter format not correct  -  "program


Arrrggg!  Just tried it on the PC in my office, running Win2k Pro.  Same error!  It works fine for me under Win98SE.
Logged

Ghost_Rider
Senior Member
*
Offline Offline

Posts: 217



View Profile
« Reply #11 on: February 19, 2005, 01:40:34 AM »

That is weird!  It works for me too.  (On WinXP SP2)

C:\>cd "program files"

C:\Program Files>

So you are in a DOS command prompt, and the current directory you are in is just "C:\>" ?

I tried this in DOSBox just for the heck of it, and it does not work there.  In DOSBox you have to use:  progra~1

If you are just using your command prompt (or "Run" cmd)... it should work?
Logged
Tom
Administrator
Senior Member
*
Offline Offline

Posts: 5,618



View Profile WWW
« Reply #12 on: February 19, 2005, 02:02:29 AM »

Yep.  A command prompt, at the root.  

When I do it in Win98, I'm at a MS-DOS prompt.  In XP, I'm at the Command Prompt.  I didn't try it in Win98 under the command prompt.

And therein lies the rub.

You guys are going through a menu to get to Accessories/Command Prompt?  Works for me if I do that, too!  Yippie.  

HOWEVER, I'm running the program, "command" from the START/RUN menu; typing in "command" for the program to run.  This is basically how I have to work with mysql and other server programs -- from the 'shell', as it were.
Logged

Ghost_Rider
Senior Member
*
Offline Offline

Posts: 217



View Profile
« Reply #13 on: February 19, 2005, 03:37:27 AM »

I gotcha... and I see what you mean now!  





Instead of going to run and typing "command" ... try typing "cmd" instead

Not sure if this will work for what you are doing.... but when I first was trying this out, I used "cmd" from the start/run menu, and it worked.

Logged
QBiN
Member
*
Offline Offline

Posts: 44


View Profile
« Reply #14 on: February 19, 2005, 06:01:31 AM »

Ghost Rider is right! I just tested with the same results.

The fact is... The *native* command prompt for Win2000 / WinXP is "cmd"... NOT "command".

Windows XP runs "cmd" when you select Command Prompt from your accessories menu.

the "cmd" version of the shell appears to have the newer LFN functionality while the "command" shell seems like a throwback to DOS 5.0.

For your purposes, Tom, I'd steer clear of "command" from here on out.
Logged
Zemus
Senior Member
*
Offline Offline

Posts: 1,366


View Profile WWW
« Reply #15 on: February 19, 2005, 07:29:25 AM »

Seems like command.com is a leftover from the earlier versions of Windows. If you go into the system32 folder you can find more leftovers, like edit.com and edlin.exe. Both old MS-DOS programs.
Logged
Kaminari
Senior Member
*
Offline Offline

Posts: 149



View Profile WWW
« Reply #16 on: February 19, 2005, 09:16:16 AM »

Quote from: Ghost_Rider
I tried this in DOSBox just for the heck of it, and it does not work there.


That's most probably because DOSBox emulates DOS 5, which didn't have LFN support.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: