• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 556
  • Last Modified:

VBScript Drive Mapping Question

I need to map a drive letter to a local folder (C:\temp) in order for one of our document management programs to function.  I need to do this in a vbscript and it has always been in autoit in the past. Can someone point me in the right direction.  I have tried using a normal mapping but that does not work. Any ideas?  Thanks..
0
TheITGuy
Asked:
TheITGuy
  • 2
1 Solution
 
ColemssCommented:
0
 
RobSampsonCommented:
Hi, why would you need to map a drive to a local folder?

If you really need to do that, try this:
Set objShell = CreateObject("WScript.Shell")
strDrive = "X:"
strPath = "C:\Temp"
objShell.Run "cmd /c SUBST " & strDrive & " " & strPath, 1, True


Or, if it's a network share:
Set objNetwork = CreateObject("WScript.Network")
strDrive = "X:"
strPath = "\\server\share"
objNetwork.MapNetworkDrive strDrive, strPath

These are both VBS scripts, by the way.

Regards,

Rob.
0
 
TheITGuyAuthor Commented:
I will give it a shot when I get in tomorrow morning.  We are running Documentum 5 for our document management system and it requires this for a temp folder.  I am sure we could do it some other way but this is the way they set it up originally so we are stuck with it for now.  Either way I will give it a go in the morning and let you know.  Thanks for the input.
0
 
RobSampsonCommented:
Hmmm, does it need to be a "drive letter" to a local folder (in which case SUBST will do the job), or does it need an environment variable set to it, like the way %temp% works (In DOS type: echo %temp%)?

Anyway, try out what I posted, and see how you go?

Regards,

Rob.
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now