behdadsoft Posted August 11, 2018 Share Posted August 11, 2018 (edited) Hi. I want create a Map drive by autoit, but it always return @error = 0 and can't create Map Drive. At the first, I shared my drive and then with below code i tried to Add Map Drive. but it can't create. DriveMapAdd("*", "\\" & @ComputerName & "\shared") NOTE: I used Windows 10. Edited August 11, 2018 by behdadsoft Link to comment Share on other sites More sharing options...
orbs Posted August 11, 2018 Share Posted August 11, 2018 (edited) that works for me. i advise you to verify that Windows does accept the share name you designate to it (because by default, Windows would share your folder by the name of the folder). to verify that, open the "Computer Management" (compmgmt.msc) and navigate to the "Shares" list. of course, permissions may also be an issue. one more thing to check: if you do not specify a drive letter, Windows may assign you a drive letter already in use by a removable device (e.g. USB drive). try to specify a drive letter that you know for a fact that is available. Edited August 11, 2018 by orbs Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
behdadsoft Posted August 11, 2018 Author Share Posted August 11, 2018 There is my shared folder in "Shares" list. so for permissions, do you have any idea? Link to comment Share on other sites More sharing options...
orbs Posted August 11, 2018 Share Posted August 11, 2018 (edited) first i advise you check the return value of your function, like this: Global $xRet = DriveMapAdd("*", "\\" & @ComputerName & "\shared") ConsoleWrite('return value = ' & $xRet & @CRLF & '@error value = ' & @error & @CRLF) if you claim @error = 0, then i truly wonder what is the return value. i will check on Windows 10 shortly (i'm on Windows 7). Edited August 11, 2018 by orbs Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
behdadsoft Posted August 11, 2018 Author Share Posted August 11, 2018 It return Empty String. Link to comment Share on other sites More sharing options...
orbs Posted August 11, 2018 Share Posted August 11, 2018 works as expected for me on Windows 10. retro-check: you get a return value of empty string and @error value of 0? your share appears on the "Shares" list with its name set to the name you specified ("shared")? Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
behdadsoft Posted August 11, 2018 Author Share Posted August 11, 2018 (edited) Quote you get a return value of empty string and @error value of 0? Yes. Quote your share appears on the "Shares" list with its name set to the name you specified ("shared")? Yes. I use Windows 10 x64. Edited August 11, 2018 by behdadsoft Link to comment Share on other sites More sharing options...
orbs Posted August 11, 2018 Share Posted August 11, 2018 1) what if you set a specific available drive letter (e.g. "Z:" instead of "*")? same return and @error values? 2) shot in the dark: disable your anti-virus and recheck. Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
behdadsoft Posted August 11, 2018 Author Share Posted August 11, 2018 Quote 1) what if you set a specific available drive letter (e.g. "Z:" instead of "*")? same return and @error values? Return 0 and 0. but when i run it again, error code is 3 and return 0. while there is no Map Drives. Quote 2) shot in the dark: disable your anti-virus and recheck. I do that, but nothing changed. Link to comment Share on other sites More sharing options...
behdadsoft Posted August 11, 2018 Author Share Posted August 11, 2018 Now after changed "*" to "Z:", it give me an error 0 and made Different Map drives, but they don't show in My Computer. I test this code on two PC with Windows 10 X64, but both have same result. Link to comment Share on other sites More sharing options...
orbs Posted August 11, 2018 Share Posted August 11, 2018 1 minute ago, behdadsoft said: made Different Map drives what does that mean? Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
behdadsoft Posted August 11, 2018 Author Share Posted August 11, 2018 (edited) it make different drives. first MsgBox give me @error, and second MsgBox give me return drive map. $Map = DriveMapAdd("*", "\\" & @ComputerName & "\Shared") MsgBox(0,"",@error) MsgBox(0,"",$Map) Edited August 11, 2018 by behdadsoft Link to comment Share on other sites More sharing options...
orbs Posted August 11, 2018 Share Posted August 11, 2018 and P: does not appear in "My Computer"? what about cmd "dir P:"? Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
behdadsoft Posted August 11, 2018 Author Share Posted August 11, 2018 The system cannot find the path specified. Link to comment Share on other sites More sharing options...
behdadsoft Posted August 11, 2018 Author Share Posted August 11, 2018 (edited) i don't know what happen. now it work fine and made a Map Drive. but i don't know why @error is 0. this result is same on both PCs. Edited August 11, 2018 by behdadsoft Link to comment Share on other sites More sharing options...
orbs Posted August 11, 2018 Share Posted August 11, 2018 @error 0 means OK, no error. behdadsoft 1 Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
behdadsoft Posted August 11, 2018 Author Share Posted August 11, 2018 (edited) I found what is the problem. problem is relate to this part of my code: #RequireAdmin when i removed it, my code work very well. Quote @error 0 means OK, no error. According to Help: thank you for your helps. +1 Edited August 11, 2018 by behdadsoft Link to comment Share on other sites More sharing options...
Developers Jos Posted August 11, 2018 Developers Share Posted August 11, 2018 (edited) Please do not report posts when you think there is a bug. So for starters: You never mentioned you where running this script in Admin mode, which is quite essential to mention when reporting issues. Are you getting a UAC prompt and if so are you using the same account? Please explain why you think there is a bug in AutoIt in stead of your script and exactly describe what you are doing! Jos Edited August 11, 2018 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
jdelaney Posted August 11, 2018 Share Posted August 11, 2018 (edited) Several reasons a drive won't get mapped. If your current user is a local account, you'll need to pass in credentials to map to a remote computer. If you are using a network account, but running elevated, you will also need to pass in credentials. If you are using a network account, and not running elevated, windows automagically use your login credentials to map a drive. So if you have the permissions on the server you are mapping you will automatically succeed in the mapping. Other reasons a drive will failed to get mapped is if there is already another mapped drive to that server. There are workarounds for this, you can instead map by the IP. I'd suggest you attempt to pass in credentials to the function, with a user that has the rights on the target machine. Edited August 11, 2018 by jdelaney behdadsoft 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
behdadsoft Posted August 13, 2018 Author Share Posted August 13, 2018 Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now