Thread: Changing drive letter to go on a network

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    7

    Changing drive letter to go on a network

    Hello, I wanted to make a program for myself and give it to my system administrator for a system flaw I found in the school network.

    What we have: A network with several users that have his/her own personal folder.
    What is flawed: Other people can get in other certain users' folders, most are blocked.
    What I want to do: Get a directory listing of those accessibly through my user name

    Hark, nobody make the source code to do this. I only want to find out how you can change into another directory in DOS (The system("h:\") command does not work.

    Here's a small code snippet that I've done so far:

    #include <iostream>
    using namespace std;
    #include <conio.h>
    #include <stdlib.h>

    int main(int argc, char* argv[])
    {

    character = _getch();
    switch(character)
    {
    case 97:
    cout << "Type in a server name.\n";
    cin.getline(server, 49);
    system("cls");
    system("net use h: \\\\(server IP/name)\\c");
    getch();
    system("cd h:");
    getch();
    system("cd h:\\");
    system("dir");
    cout << "You have ? changed the directory ?";

    So far, I cannot change the directory using the cd command, and then using dir, because it will always show the C:\ directory, not the H:\.

    As I hope you can see (it's pretty easy to figure out what my code does) I only need to find out how to change to another directory in a network using the system() command if possible. (Please, simplified answers, I'm a beginner.)

    Thank you

    ~zornedge

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    14

    Lightbulb try this

    In dos
    cd h:\

    doesn't work.
    cd = change directory not drive

    to change drives you just type the drive letter eg...
    h:\

    try system("h:\\");
    that should take you to the h drive.

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    7

    However...

    I have tried system("h:\\") myself, and it does go to the H:\ drive.
    However, when I execute the command system("dir") it displays the contents of the folder where my file contents are, not the H:\ drive content.

    Do you have any other suggestions?

    I might have to learn new code to do this. (Beginner-friendly code)

    Oh, by the way, system("dir h:\\") or system("dir h:") does work, displaying directory information. But I need to get on the drive, not just get it from another remote computer in order to do a search, but I suppose searching from another computer on a program is possible by telling the program where to search. This is a method I'll have to consider.

    ~zornedge
    Last edited by zornedge; 11-29-2001 at 07:36 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help using strings and mapping
    By trprince in forum C Programming
    Replies: 29
    Last Post: 12-01-2007, 04:01 PM
  2. Drive letter
    By opafire in forum C++ Programming
    Replies: 8
    Last Post: 04-22-2004, 08:02 PM
  3. File I/O on Network drive, Quick Question
    By kransk in forum C++ Programming
    Replies: 3
    Last Post: 11-24-2003, 09:17 AM
  4. Choosing drive letter
    By *ClownPimp* in forum Tech Board
    Replies: 4
    Last Post: 07-11-2003, 02:40 PM
  5. changing drive letter gaining access to a network
    By zornedge in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 11-29-2001, 10:57 AM