Avoiding "Cmd.exe - No Disk There is mo disk in the drive" Message Box in Win 10 RRS feed

  • General discussion

  • My bat file no longer works without popping up a nasty Message Box

    "Cmd.exe - No Disk There is mo disk in the drive" in Win 10

    All it is doing is going through all the drive letters to find which is the one I just inserted, so it can run something located in that drive.

    Batch script goes like this:

    set dd=
    FOR %%i IN (d e  f g h i j k l m n) DO if exist %%i:\MyExecutable.exe set dd=%%i
    echo dirve is %dd%


    • Changed type Bill_Stewart Friday, January 26, 2018 2:44 PM
    • Moved by Bill_Stewart Friday, January 26, 2018 2:45 PM This is not "scripts on demand"
    Wednesday, November 15, 2017 1:46 PM

All replies

  • Don't forget to ask your question.

    -- Bill Stewart [Bill_Stewart]

    Wednesday, November 15, 2017 3:02 PM
  • Bill,

    My question is: in Win 10, how do I write a batch script to loop through a list of possible drives (D:, E:, F:,...) to find the first one that both exists and contains a file of interest (MyExecutable.exe), without having to close an Error Message Box for each test. 

    Tuesday, November 28, 2017 5:35 AM
  • The following will search all available drives for a file and produce no errors.

    wmic datafile where "filename='myExecutable' AND extension='exe'" get name


    • Edited by jrv Tuesday, November 28, 2017 8:20 AM
    Tuesday, November 28, 2017 8:17 AM