I want to install a USB printer on a Windows standard embedded system without Plug & Play functionality and without the Hardware Wizard.
To install a printer using .inf file I use the following code:
sprintf(c_Buffer, "rundll32 printui.dll,PrintUIEntry /ii /f %s", FileName);
system(c_Buffer);
After this function I can use the Windows wizard to add the printer.
Is there a way to use also this or a similar function to install a USB Printer?
Related
I am currently trying to uninstall display adapter driver in power shell.
I can simply go to device manager to find display adapter and uninstall the driver and then install the new driver. But I want to write an automated script to make it easy.
I tried to use "pnputil.exe -f -d oem##.inf" in power shell to uninstall the display adapter driver.
But it did not work and gave me something like that
"Deleting the driver package failed: One or more devices are presently installed using the specified INF"
Does anyone know how can I solve this problem and make pnputil work?
This isn't a PowerShell question really, as it's a window util.
from running pnputil /?
/delete-driver <oem#.inf> [/force]
Delete driver package from the driver store.
/force - delete driver package even when it is in use by devices.
so running pnputil.exe /delete-driver oem##.inf /force should work for you.
Example removing a device using the driver first on the commandline with devon. Devon comes with the Window SDK. Windows SDK - Windows app development _ Microsoft Developer The pnputil command should work after that.
devcon remove "HDAUDIO\FUNC_01&VEN_1013&DEV_4206&SUBSYS_106B0600"
I am trying to run devcon command on windows7 as below but this is stuck forever,if I right-click on "scan for hardware changes" it is stuck aswell,how can I activate a COM port via commandline using devcon?is there a better way?
devcon.exe restart "#USB\VID_05C6&PID_9302&MI_01\6&1E2FC975&0&0001"
Is there a way to forcibly change drivers for particular devices in a batch file?
What my issue is here is that I'm trying to automate the process of selecting the correct driver for a projector that is connected to a computer and right now the projector is turned on automatically after the computer is started through a batch file.
However generic drivers are selected instead of the proper driver for that projector.
Is there a command I can use to forcibly change the driver for that projector or is there another way to change the default driver from the generic to the one I need automatically rather than manually?
In your batch file you need to find out:
Windows x86 (32 bit) or Windows x64 (64 bit) for example with:
if "%ProgramFiles(x86)%" == "" goto Driver32Bit
:Driver64Bit
echo Detected Windows x64
rem Commands for installing correct 64 bit driver after determining Windows version.
goto :EOF
:Driver32Bit
echo Detected Windows x86
rem Commands for installing correct 32 bit driver after determining Windows version.
goto :EOF
Windows version using command ver for selecting correct driver directory.
In each directory containing the driver files for appropriate Windows there should be dpinst32.exe or dpinst64.exe to install the driver. See Driver Package Installer (DPInst) for details about this free Microsoft application for installing drivers.
Very often the manufacturer of the driver delivers the driver packages already with dpinst32.exe and dpinst64.exe as often used by their own driver installers, too. Otherwise you need to download Windows Driver Kit and extract those two files from WDK package. Installing WDK is not necessary.
I have a .inf file and a .sys file and a couple of dll's.
to install the driver manually i do from elevated command prompt :
devcon install driver.inf HID\driver
I want some pointers on how to make the installer for this driver .
Thanks.
PS: I am a complete noob when it comes to things related to drivers.
We can use a simple installer based on NSIS that copies the files and executes the command . Also devcon binary is not redistibutable but we can copy parts of the devcon source that we need in order to create a specific driver installer binary.
My 3G wireless device is not available after I put my PC to sleep and then wake the PC. In the Connection Manager it says "Device disabled by Device Manager".
So I go to the device manager, disable the device, then enable the device. Then the Connection Manager can use it again.
I'd like to disable, then enable the device with some script which I can automatically execute when the PC wakes from sleep or hibernate.
Can this be achieved with a script? My OS is Windows 64bit and it seems that the DevCon command-line utility is not available for 64 bit (except Itanium processors).
Newer versions of the Windows Driver Kit contain a devcon.exe which will run on Windows 7 / 64 bit.
After making sure devcon.exe was in my PATH (e.g. c:\Windows\System32), I used this command at a DOS prompt to find the hardware ID of my 3G Network Adapter:
devcon hwids *usb*
Then this batch file which I Run As Administrator from the desktop does the job:
CLS
devcon status "USB\VID_03F0&PID_371D"
#ECHO.
devcon disable "USB\VID_03F0&PID_371D"
#ECHO.
devcon enable "USB\VID_03F0&PID_371D"