1

I need to install a .bat file on windows 10 , x64, but the file does not run when I click it , nither as an admin , is there a solution for this ?

inside the instal.bat is written :

@devcon remove root\mcamvusb
@devcon install mcamvusb.inf root\mcamvusb

which is , there is a devcon.exe file in the same foledr, that instal.bat should run it

15
  • Take off the @ signs and see what output you get, they might be suppressing some useful information, and add pause at the end.
    – Jonno
    Jan 16, 2016 at 13:30
  • Are you saying the batch file doesn't even open, or there was no output?
    – Jonno
    Jan 16, 2016 at 13:42
  • it doesn't even open
    – Farzad64
    Jan 16, 2016 at 13:45
  • 1
    I just noticed the error message you posted was "devon was not distinguished as a bach file or executable file", yet the batch file you posted has devcon, i.e,, it has a "c", but the error message you posted has "devon". Do you have a typo in one of them? You could also try running the executable outside of the batch file, e.g. C:\Users\JDoe\Documents\devcon remove root\mcamvusb, substituting the appropriate directory.
    – moonpoint
    Jan 16, 2016 at 19:06
  • 1
    Also, make sure you have the right devcon.exe - under x64 Windows you must run the 64-bit devcon.exe. See Quick Method to install DevCon.exe? for options to get it.
    – dxiv
    Jan 16, 2016 at 23:25

2 Answers 2

1

"there is a devcon.exe file in the same folder, that instal.bat should run it"

devcon.exe is not available in Windows working directory by default, that's why you have to change your working directory to .bat file location (which also includes devcon.exe). To do this, add this line to the first of .bat file (you can suppress /d if the script is located in drive C):

@cd /d "%~dp0"

Which should look like:

@cd /d "%~dp0"
devcon remove root\mcamvusb
devcon install mcamvusb.inf root\mcamvusb
pause
0

When an application displays a message in the form you posted when you run it, i.e., devcon [-r][-m:\\machine] <command> [<arg>..] it usually means you did not use the proper syntax for the command, so it is trying to help you by showing you the correct syntax. When things appear in brackets, i.e., between [ and ] it usually means they are optional. E.g., [-r] means you don't always enter -r, but only when it is needed for a particular operation that can be performed by the command. That option will cause devcon to reboot the system, if a reboot is needed after the command is run. Since you are running the command on the system on which you wish it to perform its operations, you don't need to specify -m:\\machine, and it is put between brackets to show that argument to the command is optional.

The install and remove options to devcon in the lines from the batch file that you posted are valid options as shown at Device Console (DevCon.exe) Commands. I don't know whether what you specified in the devcon remove command is valid for your system, but, perhaps it might help to check on whether the version of devcon you are using is the appropriate one for your version of Windows as dxiv suggested in his comment where he noted:

under x64 Windows you must run the 64-bit devcon.exe.

You can check whether you have a 32-bit or 64-bit version of Windows 10 by running the command wmic os get OSArchitecture at a command prompt. You can check whether you have a 32-bit or 64-bit version of an application, such as devcon.exe by right-clicking on it in the Windows File Explorer, then choosing Properties and then clicking on the Compatibility tab. Then check the check box for "Run this program in compatibility mode for". If you see Windows XP listed as an option, then the program is a 32-bit program, not a 64-bit program, since Windows XP compatibility mode is not an option for a 64-bit application.

2
  • thank you for your perfect answer, no it seems it's for x64 , and also my windows 10 is x64 , if I eliminate the command devcon remove, would it help ?
    – Farzad64
    Jan 17, 2016 at 8:19
  • If the answer is perfect, and is applicable to your system, how does this not answer your question? If you want help you need to clarify your question.
    – Ramhound
    Mar 1, 2016 at 20:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .