Enable/disable a device from the command line

本文介绍如何使用Devcon软件通过命令行启用或禁用Windows XP系统中的设备。包括下载安装Devcon、查找设备标识符及启用禁用指定设备的具体步骤。

Enable/disable a device from the command line



This article lets users enable/disable a tag from command line in a few easy steps.
The document shows how to carry out this activity on Windows XP by installing Devcon. The link to download this is provided in the article. This software displays all devices and thus the user can enable or disable a device according to his requirement. The commands for the same are included in the article.

This allows for example to enable / disable your internet connection (or network card) on the command line.

Install Devcon

  • 1. Download it on Microsoft Website : Link
  • 2. Unpack the file, once downloaded
  • 3. Copy \i386\devcon.exe to c:\windows\system32
  • 4. Locate the device that you want : in the command prompt type:
    devcon find *

Display all the devices in the system

  • In the command prompt, type
    devcon find *> list.txt 
    • To get the list in a file.
  • For example, my network card Accton appears as:
    • PCI\VEN_1113&DEV_1211&SUBSYS_12111113&REV_10\3&13C0B0C5&0&48: Accton EN1207D Series PCI Fast Ethernet Adapter #2 


To choose a piece of the string that identifies the device, and verify it is unique:

c:\>devcon find *VEN_1113  
PCI\VEN_1113&DEV_1211&SUBSYS_12111113&REV_10\3&13C0B0C5&0&48: Accton EN1207D Ser  
ies PCI Fast Ethernet Adapter #2  
1 matching device(s) found.



Make be sure that "VEN_1113" means a single network card.

Enable/disable the device


devcon disable *VEN_1113   
devcon enable *VEN_1113 


This allows me to enable / disable my network card (and therefore my internet connection) from the command line.

Other devices

  • The floppy disk drive is:
    • ACPI\PNP0700\3&13C0B0C5&0 : standard disk controller
  • To disable / enable it at will:
    • devcon disable * PNP0700 
    • This eliminated the floppy drive system!
  • To prevent your computer from beeping:
    • ROOT\LEGACY_BEEP\0000 : Beep

Obtaining file:///home/aaeon/xk_ws/mmseg/mmdeploy-main Running command python setup.py egg_info A module that was compiled using NumPy 1.x cannot be run in NumPy 2.2.6 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'. If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2. Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 35, in <module> File "/home/aaeon/xk_ws/mmseg/mmdeploy-main/setup.py", line 8, in <module> import torch File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/torch/__init__.py", line 1382, in <module> from .functional import * # noqa: F403 File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/torch/functional.py", line 7, in <module> import torch.nn.functional as F File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/torch/nn/__init__.py", line 1, in <module> from .modules import * # noqa: F403 File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/torch/nn/modules/__init__.py", line 35, in <module> from .transformer import TransformerEncoder, TransformerDecoder, \ File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/torch/nn/modules/transformer.py", line 20, in <module> device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'), /home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/torch/nn/modules/transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at /tmp/pytorch/torch/csrc/utils/tensor_numpy.cpp:84.) device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'), /home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer. warnings.warn( WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/23/3a/5b92bfff9c1cc1179a493684d0e6a893ee7cd69c4f1977813000ea76c5d7/cython-3.1.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl WARNING: Connection timed out while downloading. error: incomplete-download × Download failed because not enough bytes were received (0 bytes/3.2 MB) ╰─> URL: https://files.pythonhosted.org/packages/23/3a/5b92bfff9c1cc1179a493684d0e6a893ee7cd69c4f1977813000ea76c5d7/cython-3.1.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl note: This is an issue with network connectivity, not pip. hint: Consider using --resume-retries to enable download resumption. Traceback (most recent call last): File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/setuptools/installer.py", line 82, in fetch_build_egg subprocess.check_call(cmd) File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/subprocess.py", line 369, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/home/aaeon/anaconda3/envs/py3.10/bin/python3.10', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp1wjeie4e', '--quiet', 'cython']' returned non-zero exit status 1. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 35, in <module> File "/home/aaeon/xk_ws/mmseg/mmdeploy-main/setup.py", line 184, in <module> setup( File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/setuptools/__init__.py", line 154, in setup _install_setup_requires(attrs) File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/setuptools/__init__.py", line 148, in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/setuptools/dist.py", line 812, in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/pkg_resources/__init__.py", line 771, in resolve dist = best[req.key] = env.best_match( File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1056, in best_match return self.obtain(req, installer) File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1068, in obtain return installer(requirement) File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/setuptools/dist.py", line 883, in fetch_build_egg return fetch_build_egg(self, req) File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/setuptools/installer.py", line 84, in fetch_build_egg raise DistutilsError(str(e)) from e distutils.errors.DistutilsError: Command '['/home/aaeon/anaconda3/envs/py3.10/bin/python3.10', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp1wjeie4e', '--quiet', 'cython']' returned non-zero exit status 1. error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip. full command: /home/aaeon/anaconda3/envs/py3.10/bin/python3.10 -c ' exec(compile('"'"''"'"''"'"' # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py # # - It imports setuptools before invoking setup.py, to enable projects that directly # import from `distutils.core` to work with newer packaging standards. # - It provides a clear error message when setuptools is not installed. # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so # setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning: # manifest_maker: standard file '"'"'-c'"'"' not found". # - It generates a shim setup.py, for handling setup.cfg-only projects. import os, sys, tokenize, traceback try: import setuptools except ImportError: print( "ERROR: Can not execute `setup.py` since setuptools failed to import in " "the build environment with exception:", file=sys.stderr, ) traceback.print_exc() sys.exit(1) __file__ = %r sys.argv[0] = __file__ if os.path.exists(__file__): filename = __file__ with tokenize.open(__file__) as f: setup_py_code = f.read() else: filename = "<auto-generated setuptools caller>" setup_py_code = "from setuptools import setup; setup()" exec(compile(setup_py_code, filename, "exec")) '"'"''"'"''"'"' % ('"'"'/home/aaeon/xk_ws/mmseg/mmdeploy-main/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' egg_info --egg-base /tmp/pip-pip-egg-info-qwudrxft cwd: /home/aaeon/xk_ws/mmseg/mmdeploy-main/ Preparing metadata (setup.py) ... error error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for details. (py3.10) aaeon@aaeon-desktop:~/xk_ws/mmseg/mmdeploy-main$ pip install -e . Obtaining file:///home/aaeon/xk_ws/mmseg/mmdeploy-main Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [67 lines of output] A module that was compiled using NumPy 1.x cannot be run in NumPy 2.2.6 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'. If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2. Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 35, in <module> File "/home/aaeon/xk_ws/mmseg/mmdeploy-main/setup.py", line 8, in <module> import torch File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/torch/__init__.py", line 1382, in <module> from .functional import * # noqa: F403 File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/torch/functional.py", line 7, in <module> import torch.nn.functional as F File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/torch/nn/__init__.py", line 1, in <module> from .modules import * # noqa: F403 File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/torch/nn/modules/__init__.py", line 35, in <module> from .transformer import TransformerEncoder, TransformerDecoder, \ File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/torch/nn/modules/transformer.py", line 20, in <module> device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'), /home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/torch/nn/modules/transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at /tmp/pytorch/torch/csrc/utils/tensor_numpy.cpp:84.) device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'), /home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer. warnings.warn( WARNING: Connection timed out while downloading. error: incomplete-download × Download failed because not enough bytes were received (0 bytes/3.2 MB) ╰─> URL: https://files.pythonhosted.org/packages/23/3a/5b92bfff9c1cc1179a493684d0e6a893ee7cd69c4f1977813000ea76c5d7/cython-3.1.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl note: This is an issue with network connectivity, not pip. hint: Consider using --resume-retries to enable download resumption. Traceback (most recent call last): File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/setuptools/installer.py", line 82, in fetch_build_egg subprocess.check_call(cmd) File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/subprocess.py", line 369, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/home/aaeon/anaconda3/envs/py3.10/bin/python3.10', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpmuq3o4i0', '--quiet', 'cython']' returned non-zero exit status 1. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 35, in <module> File "/home/aaeon/xk_ws/mmseg/mmdeploy-main/setup.py", line 184, in <module> setup( File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/setuptools/__init__.py", line 154, in setup _install_setup_requires(attrs) File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/setuptools/__init__.py", line 148, in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/setuptools/dist.py", line 812, in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/pkg_resources/__init__.py", line 771, in resolve dist = best[req.key] = env.best_match( File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1056, in best_match return self.obtain(req, installer) File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1068, in obtain return installer(requirement) File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/setuptools/dist.py", line 883, in fetch_build_egg return fetch_build_egg(self, req) File "/home/aaeon/anaconda3/envs/py3.10/lib/python3.10/site-packages/setuptools/installer.py", line 84, in fetch_build_egg raise DistutilsError(str(e)) from e distutils.errors.DistutilsError: Command '['/home/aaeon/anaconda3/envs/py3.10/bin/python3.10', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpmuq3o4i0', '--quiet', 'cython']' returned non-zero exit status 1. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for details.
06-28
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值