Sign in to follow this  
Followers 0
MattX

Variable to a net use DOS

5 posts in this topic

Am I missing something thats gonna slap me in the face here ?

I want to pass a variable to a net use command so I [ well not me, teachers ] can map a drive to a students home dir. Code I have is as follows:

; AutoIt Version:    2.64
; Language:          English
; Platform:          WinXP
; Author:            Matt ********************  
; Script Function:  Maps a drive to a students home directory

start:

InputBox, usernum, Student Home Drive Mapper, Please Enter number corrasponding to the User ID.
    FileReadLine, user, c:\\matt\\students2.txt, %usernum%
        MsgBox, 4, Is this the student ?, %user%
            IfMsgBox, NO, Goto, start
            
;map drive

run, %comspec% /c net use s: /d
    sleep, 2000
        run, %comspec% /c net use s: \\\\*****01\\%user%

I have tried to use the %clipboard% variable too but no luck - is there a way I can get the %user% variable to DOS so I can map the drive ?

Share this post


Link to post
Share on other sites



Everything looks fine ?!

Share this post


Link to post
Share on other sites

Have you tried using EnvSet and EnvUpdate? Check Helpfile under Function Reference, Environment Management. You may have to create an environment variable to use in the OS.

Example: ; Set TMPCLASSPATH environment variable

EnvSet("TMPCLASSPATH", $Nline)

with $Nline being the new value you want to set it to.

I hope this helps.

RocTx

Share this post


Link to post
Share on other sites

Thanks for the tips, its a little strange why it won't work, the only thing I can think of is that I am testing it on my laptop which is not part of the domain. I tried the net use from my laptop just to see if it would work - [ not using the variable ] and it worked fine.

I'll try a runwait tomorow and also try it on a PC which is part of the domain.

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0