01-29-2025, 02:45 AM
Just ran into a little oops.
Writing a small backup utility to copy files from a mapped drive to a USB Thumb Drive.
I initially couldn't work out why it was silently failing with "Compile and Execute"
I tried running the executable from Windows Explorer and it worked.
Then it dawned on me :
I have PBEdit and PBWin set to "run as Administrator' to avoid the known issues with occasional slow compilation and/or compiler fails.
"Administrator " didn't have the drive mapping.
My solution:
Writing a small backup utility to copy files from a mapped drive to a USB Thumb Drive.
I initially couldn't work out why it was silently failing with "Compile and Execute"
I tried running the executable from Windows Explorer and it worked.
Then it dawned on me :
I have PBEdit and PBWin set to "run as Administrator' to avoid the known issues with occasional slow compilation and/or compiler fails.
"Administrator " didn't have the drive mapping.
My solution:
Code:
dwDrives = GetLogicalDrives
IF BIT(dwDrives,25) = 0 THEN ' Drive Z not available
? "Cannot access source drive Z:\." & $LF & $LF & "You must run this application as a user with drive Z:\ mapped!" & $LF & $LF & _
"Note that the backup will fail if you run ""as administrator"" rather than as a normal user who has Z:\ mapped",%MB_ICONERROR,"Backup To USB Failed"
EXIT FUNCTION
END IF