2

I can no longer use / at the windows xp command prompt, and it seems to have started after a botched cygwin installation, e.g. cd /windows won't work, but used to.

Can anyone think of how this might have happened?

OOPS! It doesn't normally work in XP, though I had read that it does in Vista. I simplified my problem and it was wrong. The real problem is:

I was using the cwrsync binaries (meant for cygwin use) that can be used at the command prompt in a way such as:

ssh -i /keydir/keyfile user@server

but after doing something (seems like it was installing cygwin), and even after reinstalling the cwrsync files, I can now only do:

ssh -i \keydir\keyfile user@server, i.e. I have to use the windows convention when referring to local files.

I posted this on the cwrsync forum, but it's not very active, so I was hoping someone might recognize what's going on here, I should maybe try the cygwin forum too.

Makoto
  • 104,088
  • 27
  • 192
  • 230
user23119
  • 21
  • 1
  • 2
  • 4
  • I believe the tags "forward" and "slash" were supposed to be one tag: "forward-slash". Could someone fix that, please? Or just delete the "forward" tag, but I think "forward-slash" is preferable to "slash" as a tag. – Alan Moore Oct 14 '08 at 06:00

2 Answers2

3

Actually, since DOS 2.0, the kernel and file APIs have always supported forward slash, and many command line calls. See: http://blogs.msdn.com/larryosterman/archive/2005/06/24/432386.aspx.

I used to go to great pains to detect the OS and use a PATH_SEPARATOR type constant in PHP, when I discovered this by accident (it's use is now considered deprecated, in lieu of a simple "/").

Cheers.

  • 1
    According the the MSDN, forward slashes are preferred over single and double backslashes for hardcoded paths in source code and in the registry. Support for them in user programs is variable however. – James Broadhead Apr 26 '11 at 12:53
1

You imagined it - it never worked.

If you happen to be in C:\ and type

C:\>cd /windows

it will take you to C:\WINDOWS\ but that's only because /windows is not a valid option to cd, so it tries ignoring the /.

Forward slash is a path separator in UNIX and cygwin, but Windows uses it for commandline options, eg. dir /w.

Hugh Allen
  • 6,509
  • 1
  • 34
  • 44
  • 3
    I haven't tested this on XP, but Windows 7 definitely allows things like `cd C:/Windows/System32`. – user541686 Sep 06 '11 at 02:46
  • @Mehrdad But you notice the difference -- `C:/` does not begin with a slash which is the reason it's not mistaken for a command line option, as opposed to the OP's path. – Peter - Reinstate Monica Mar 14 '18 at 11:29
  • @PeterA.Schneider: Try `C: && cd /Windows`. (Also, I just tested it on XP, and it doesn't work there. So I guess it's a newer feature.) – user541686 Mar 14 '18 at 11:35