emendelson Posted 2 hours ago Share Posted 2 hours ago This should be obvious, but I can't find the answer anywhere. I have a For...Next routine that counts from ASCII 65 to 90 to find free drive letters, starting with A: and ending with Z: Is there a way to make it count down from 90 to 65, so it will start with Z:?? This is the code I use: For $x = 65 To 90 If DriveStatus(Chr($x) & ':\') = 'INVALID' Then $firstFree = (Chr($x) & ':') ExitLoop EndIf Next Thanks for any advice. Again, I think the answer should be obvious, but it isn't obvious to me. Link to comment Share on other sites More sharing options...
Nine Posted 2 hours ago Share Posted 2 hours ago If DriveStatus(Chr($x) & ':\') <> 'INVALID' Then “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Solution Andreik Posted 1 hour ago Solution Share Posted 1 hour ago For $x = 90 To 65 Step -1 ... Next When the words fail... music speaks. Link to comment Share on other sites More sharing options...
emendelson Posted 1 hour ago Author Share Posted 1 hour ago 31 minutes ago, Nine said: If DriveStatus(Chr($x) & ':\') <> 'INVALID' Then What I'm looking for is a drive letter that is NOT currently in use, so that I can assign it as a drive letter in a DOS emulator (DOSBox or vDos), which is why I needed = INVALID. Link to comment Share on other sites More sharing options...
emendelson Posted 1 hour ago Author Share Posted 1 hour ago 17 minutes ago, Andreik said: For $x = 90 To 65 Step -1 ... Next Thank you! I guessed that the answer was simple, but I simply didn't know what it was. Perfect! 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