%windir%

This is a discussion on %windir% within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Code: system("cd %windir%"); will not work but if u do it in command.com it will e.g. Code: C:\folder\> cd \ ...

  1. #1
    Mmm. Purple.
    Join Date
    May 2002
    Posts
    154

    %windir%

    Code:
    system("cd %windir%");
    will not work but if u do it in command.com it will

    e.g.
    Code:
    C:\folder\> cd \
    c:\>cd %windir%
    C:\windoze\>

  2. #2
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    do something like this (might not be perfect):

    char buf[20];

    sprintf (buf, "cd %s", getenv ("windir"));

    system (buf);
    hello, internet!

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21