Jump to content

Recommended Posts

Posted

Hi guys. A quick question about DriveMapAdd.

Is it possible to map a local folder eg C:\folder to a drive letter using this function - as DOS would do Subst X: C:\folder ?

If so, what is the syntax for it?

Thanks,

William

Posted

Create a share for the folder and then use DriveMapAdd like:

DrivemapAdd("*", "\\" & @ComputerName & "\folder")

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted (edited)

Create a share for the folder and then use DriveMapAdd like:

DrivemapAdd("*", "\\" & @ComputerName & "\folder")

Thanks, Water.

That works fine:

#Include <NetShare.au3>

$netshare = _Net_Share_ShareAdd ("","test",$STYPE_TEMPORARY,"C:\test")
$sFreeDrive = DrivemapAdd("*", "\\" & @ComputerName & "\test")
MsgBox (0,"Free", $sFreeDrive)
DriveMapDel ($sFreeDrive)

It will also allow me to remove my code that seeks the next free drive letter.

My concern here is that this function may be blocked if the user doesn't have enough privileges - or would this work in any circumstances where the DOS subst command would work from a batch file?

William

Edited by saywell
Posted

My concern here is that this function may be blocked if the user doesn't have enough privileges - or would this work in any circumstances where the DOS subst command would work from a batch file?

I really don't know. Best bet would be to test it on a "normal" user.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted (edited)

Water,

I shall indeed test it on various machines here at work, but the problem is that it will be running from a CD sent to other hospitals, each with their own security policies.

I guess if it works on all the ones I test here, I'll have to give it a go with the recipients and hope I don't get too many howls of anguish back! And if I do, add a test for success in setting up the share, with a fail running a different method eg writing, running and deleting a batch file!

Thanks for your help.

William

[edit] - UPDATE

The first PC I tried it on, other than my own, failed! It was OK with a DOS Subst from a batch file, though, so I think the security problem is real. Well worth a try, though!

W.

Edited by saywell

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...