MattX Posted October 7, 2004 Share Posted October 7, 2004 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 ? Link to comment Share on other sites More sharing options...
Beastmaster Posted October 7, 2004 Share Posted October 7, 2004 Everything looks fine ?! Link to comment Share on other sites More sharing options...
Administrators Jon Posted October 7, 2004 Administrators Share Posted October 7, 2004 Only thing I can think of is that you should use RunWait rather than Run. If the script exits during the net use it might kill the process before it finishes. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
RocTx Posted October 7, 2004 Share Posted October 7, 2004 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 Link to comment Share on other sites More sharing options...
MattX Posted October 7, 2004 Author Share Posted October 7, 2004 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. Link to comment Share on other sites More sharing options...
Recommended Posts