Sign in to follow this  
Followers 0
dcjohnston

Variable issue. Drive will not map.

6 posts in this topic

This is the line that works.

Runwait("net use f: \\" & $server1 & "\vol1\apps\Testdir")  ; map f: drive to apps directory

I want the \vol1\apps\Testdir to come from an ini file with:

This is the section in the .ini file

;-----------------path to pltrsm directory.

[Path]

mapping = \vol1\apps\testdir

$path1 = iniRead("c:\servers.ini", "Path", "mapping", "" )

but the drive will not map when I run the net use command with the following:

Runwait("net use f: \\" & $server1 & " & $path1")

I know it is something with my variable but I have tried everything.

Thanks

Dave

Share this post


Link to post
Share on other sites



I may be mistaken, but I think Runwait("net use f: \\" & $server1 & "$path1") should be Runwait("net use f: \\" & $server1 & $path1).

If you put "" around $path1, AutoIt sees it as a constant, not a variable.

Ian


"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Share this post


Link to post
Share on other sites

Ian you are correct. You beat me to it. You cannot put quotes around a variable.

RunWait("net use f: \\" & $server1 & $path1)

Copy and paste that and you should be good to go dcjohnston.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

I am surprised no one else has pointed this out, but if you need to enclose your variable in quotes to execute you could do:

RunWait("net use f: \\" & '"' & $server1 &  $path1 & '"')

Assuming $server1 = "MyServer" and $path1 = "\vol1\apps\Testdir" this will look something like:

net use f: "\\MyServer\vol1\apps\Testdir"

This is only useful though if the UNC contains spaces. Hope this helps!

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

I am surprised no one else has pointed this out, but if you need to enclose your variable in quotes to execute you could do:

RunWait("net use f: \\" & '"' & $server1 &  $path1 & '"')

Assuming $server1 = "MyServer" and $path1 = "\vol1\apps\Testdir" this will look something like:

This is only useful though if the UNC contains spaces. Hope this helps!

*** Matt @ MPCS

<{POST_SNAPBACK}>

Very good Matt... always showing us up! :-P Yea I didnt catch that, but never again will I not :)

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0