Command Prompt Question

C

cu

Hi I am trying to write a simple batch file that opens a command
prompt under my domain username, then maps a network drive. I can do
this fine. The thing is that I would also like to change to this new
drive but can't figure out how to execute this command in the new
command prompt window that opens. The line of code is as follows.

runas /user:domain\username "cmd /k net use x: \\server\share"

I would like to add "x:" to the batch file. Any help would be great.
Thanks
 
A

Ayush

Replied to [cu]s message :
Hi I am trying to write a simple batch file that opens a command
prompt under my domain username, then maps a network drive. I can do
this fine. The thing is that I would also like to change to this new
drive but can't figure out how to execute this command in the new
command prompt window that opens. The line of code is as follows.

runas /user:domain\username "cmd /k net use x: \\server\share"

I would like to add "x:" to the batch file. Any help would be great.
Thanks


cd /d x:\

Good Luck, Ayush.
 
C

cu

cd /d x:\

Good Luck, Ayush.
--


This is all in a batch file so I cant simply add another line that
says x: or cd /d x:\. The batch file executes this command in the
original cmd prompt window not the one that opens up after i perform
the runas command. It seems that i would need the x: command to be
contained within the quotations but can't figure out how.
 
3

3c273

Not tested. Create a batchfile (c:\myfile.bat) with the following to lines:.
net use x: \\server\share
cd /d x:\
then issue this command:
cmd /k c:\myfile.bat.
Like I said, I didn't test it but it should work.
Louis


Ayush said:
Replied to [cu]s message :
Hi I am trying to write a simple batch file that opens a command
prompt under my domain username, then maps a network drive. I can do
this fine. The thing is that I would also like to change to this new
drive but can't figure out how to execute this command in the new
command prompt window that opens. The line of code is as follows.

runas /user:domain\username "cmd /k net use x: \\server\share"

I would like to add "x:" to the batch file. Any help would be great.
Thanks


cd /d x:\

Good Luck, Ayush.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top