Teomangia
Sorry for my English.
I need to disable the energy saving of my LAN adapter with a BATCH DOS.
My solution is:
Code: Select all
set _cartsp="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}"
reg query %_cartsp% /s >appo.txt
for /f "tokens=* skip=3 " %%A IN (appo.txt) DO call :estrae "%%A"
:estrae
echo %1 |FINDSTR "4D36E972-E325-11CE-BFC1-08002bE10318" >>riga1.txt
echo %1 |FINDSTR "PnPCapabilities" >>riga2.txt
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009
There are other ways to search in the registry?
----------------------------
#2 20 Mar 2010 11:27
Simon Sheppard
How to disable power management for a network adapter when you deploy Windows XP
from https://web.archive.org/web/20110702175 ... /kb/837058
{4D36E972-E325-11CE-BFC1-08002bE10318}\DeviceNumber
Note DeviceNumber is the network adapter number. If a single network adapter is installed on the computer, the DeviceNumber is 0001.
----------------------------
#3 20 Mar 2010 12:48
Teomangia
Thanks Simon.Simon Sheppard wrote:
How to disable power management for a network adapter when you deploy Windows XP
from https://web.archive.org/web/20110702175 ... /kb/837058
{4D36E972-E325-11CE-BFC1-08002bE10318}\DeviceNumber
Note DeviceNumber is the network adapter number. If a single network adapter is installed on the computer, the DeviceNumber is 0001.
I had already read this document, but it's not correct because my computer have only one network adapter and the DeviceNumber is 0009.
Maybe it's my registy to be incorrect.
----------------------------
#4 20 Mar 2010 14:33
Teomangia
Ops, error.
There are 2 Network Adapter in my PC.
One is the WAN MINIPORT that turn on for the internet connection.
But if i use:
netsh diag show adapter
the result is:
1. [00393219] WAN Miniport (IP)
2. [00000009] NIC Fast Ethernet PCI Realtek RTL8139 Family
[00000009] is the Sub-Key that contains my network adapter !!!
----------------------------
#5 20 Mar 2010 14:40
RG
Teomangia,
This is 100 times faster on my machine. One less temp file and no subroutine. My output does not have quotes around it as yours did. Is that OK? Otherwise it is the same.
Code: Select all
set file1=riga1.txt
set file2=riga2.txt
if exist %file1% del /q %file1%
if exist %file2% del /q %file2%
set _cartsp="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}"
reg query %_cartsp% /s | FINDSTR "4D36E972-E325-11CE-BFC1-08002bE10318" >>%file1%
reg query %_cartsp% /s | FINDSTR "PnPCapabilities" >>%file2%
Windows Shell Scripting and InstallShield
----------------------------
#6 20 Mar 2010 15:51
Teomangia
Thanks RG.RG wrote:
Teomangia,
This is 1000 times faster on my machine. One less temp file and no subroutine. My output does not have quotes around it as yours did. Is that OK? Otherwise it is the same.
I agree that One less temp file and no subroutine.
But you watched the file riga1.txt ?
It's contains all the keys, but not only the key correct for the next query.
----------------------------
#7 20 Mar 2010 16:00
Teomangia
To be more precise, this is my riga1.txt:
----------------------------...\{4D36E972-E325-11CE-BFC1-08002bE10318}
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0000
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0000\Linkage
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0001
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0001\Linkage
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0001\Ndi
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0001\Ndi\Interfaces
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0002
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0002\Linkage
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0002\Ndi
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0002\Ndi\Interfaces
...
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Linkage
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Interfaces
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\params
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\params\DuplexMode
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\params\DuplexMode\enum
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\params\networkaddress
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\params\RxBufLen
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\params\RxBufLen\enum
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0010
...\{4D36E972-E325-11CE-BFC1-08002bE10318}\0010\Linkage
#8 20 Mar 2010 16:05
Teomangia
I think this solution.
But only works when there is only one adapter.
It's easy editable for more adapter.
Code: Select all
@echo off
set _cartsp=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}
netsh diag show adapter >appo.txt
for /f "tokens=1,2 skip=1 delims=]" %%A IN (appo.txt) DO set _x=%%A
set _x=%_x:~-5%
set _x=%_x: =%
set _cartsp="%_cartsp%\%_x%"
for /f "tokens=3 skip=4" %%A IN ('reg query %_cartsp% /v PnPCapabilities') DO set _x=%%A
IF [%_x%]==[0x30] (echo situazione1 >>appo.txt)
IF [%_x%]==[0x38] (echo situazione2 >>appo.txt)
IF [%_x%]==[0x20] (echo situazione3 >>appo.txt)
IF [%_x%]==[0x120] (echo situazione4 >>appo.txt)