Mapping Network via CMD with User interactions - :)

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
ibmdog
Posts: 1
Joined: 28 Jul 2013 19:44

Mapping Network via CMD with User interactions - :)

#1 Post by ibmdog » 28 Jul 2013 19:54

Morning all.

I'm having a small issue when it comes to a batch file that will allow me to

1. Map a network drive (net use u: \\Network Share\user$)
2. Open CMD and change the default C: to the newly mapped Network share (U:) - cd /DU:\
3. After changing the directory in CMD (cd /DU:\) I would like user input that would promtp to changed to a new folder within the U: e.g. cd johnsmith - having the batch go stright to U:johnsmith wouldn't be the best option as the batch needs to be used many times for different folders in the U:

I hope this doesnt confuse people - People it did make me rather dizzy

------------------
net use u: \\Network Share\user$

cd /DU:\
pause

@echo off
set /p UserInputPath= What Directory would you like?
cd U:\%username%

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Mapping Network via CMD with User interactions - :)

#2 Post by foxidrive » 28 Jul 2013 23:52

cd "U:\%UserInputPath%"

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Mapping Network via CMD with User interactions - :)

#3 Post by Squashman » 29 Jul 2013 05:22

Another option would be to use just pushd and then use relative paths.

Post Reply