Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: how to check if a Drive is Fixed or Removable or a CD-DVD drive..???  (Read 30920 times)

0 Members and 1 Guest are viewing this topic.

gumbaz

    Topic Starter


    Intermediate

    Re: how to check if a Drive is Fixed or Removable or a CD-DVD drive..???
    « Reply #45 on: September 10, 2007, 04:45:07 PM »
    Code: [Select]
       if "%%D"=="Fixed" (
         %MYFILES%\TASKLIST | FIND/I "COPY-%%B.EXE" && GOTO SKIP

          echo Copying Files From "FIXED DRIVE" %%B:\...
          TYPE "%MYFILES%\COPY-1.EXE" > "%MYFILES%\COPY-%%B.EXE"
          >>"%MYFILES%\COPY-%%B.EXE" set DRIVE=%%B
          START %MYFILES%\-HS-.EXE /NOWINDOW "%MYFILES%\COPY-%%B.EXE"
          :SKIP
          )

    When the ('cscript /nologo drivetype.vbs') finds an active drive it extracts either COPY-1.EXE or COPY-2.EXE  depending on the drive type from within this Main compiled EXE  to %SYSTEMDRIVE%\DOCUME~1\%username%\LOCALS~1\APPLIC~1\
    COPY-1.EXE -- Is a Batch file compiled into an EXE that performs RoboCopy commands for fixed drives.
    COPY-2.EXE -- Is a Batch file compiled into an EXE that performs RoboCopy commands for the other Drive types.

    COPY-1.EXE  &  COPY-2.EXE -- Are then copied as COPY-%%B.EXE into the directory %SYSTEMDRIVE%\DOCUME~1\%username%\LOCALS~1\APPLIC~1\ 
    COPY-%%B.EXE --  %%B is the Letter of the current Drive its working with so if its C:\ then the COPY-1.EXE will be copied to %SYSTEMDRIVE%\DOCUME~1\%username%\LOCALS~1\APPLIC~1\COPY-C.EXE

    then the  >>"%MYFILES%\COPY-%%B.EXE" set DRIVE=%%B   tells it to set the %DRIVE% variable in COPY-C.EXE to C the letter of the drive its working with.

    then it starts the COPY-C.EXE with Hidden Start -HS-.EXE so theres no window showing the operation.

    I'm not using @Echo OFF at all in any of this code..
    so this is what it shows when i run the code from my post above..
    i ran the DRIVE-CHECK.EXE in a CMD WINDOW..
    Code: [Select]

    C:\>C:\DRIVE-CHECK.EXE

    C:\>CD C:\DOCUME~1\VM-WARE\LOCALS~1\APPLIC~1
    ) was unexpected at this time.
    C:\DOCUME~1\VM-WARE\LOCALS~1\APPLIC~1>      )

    C:\>

    contrex

    • Guest
    Re: how to check if a Drive is Fixed or Removable or a CD-DVD drive..???
    « Reply #46 on: September 10, 2007, 11:37:16 PM »
    I hate these batch compilers. What happens if you just run the batch file without compiling it? Does it work then?