Ipconfig doesn't work inside a bat file
Posted: 31 Mar 2019 14:43
When I run my batch file it shows me:
Running in Win7 32bit
This is my batch file:
When I run it on a different computer (Also Win7) 64bit I get:
Both machines have C:\Windows\System32 in the path.
The Problem machine has an environment variable PATH:
The Problem machine also has an environment variable PATHEXT:
On the problem machine if I add path to the bat file, It shows in the cmd window:
If I add Dir /s ipconfig.exe into the bat file it shows:
If I open a CMD prompt with or without (Run as Administrator) and run ipconfig /all it runs fine.
It has the same problem with the windows firewall turned on or not.
It has the same problem with my Antivirus turned on or not. Both machines have the same antivirus.
I have Windows Defender turned off.
Both machines are running with the same user with administrator privileges.
Does anyone have any idea why Ipconfig.exe doesn't pipe the output to the find correctly?
Thanks,
Docfxit
Code: Select all
IP INFORMATION
find: 'IP Address': No such file or directory
find: 'IPv4 Address': No such file or directory
find: 'Subnet Mask': No such file or directory
find: 'Default Gateway': No such file or directory
find: 'Host Name': No such file or directory
find: 'DNS Suffix Search List': No such file or directory
find: 'Physical Address': No such file or directory
find: 'DHCP Enabled': No such file or directory
find: 'DHCP Server': No such file or directory
Enter the ping options:
This is my batch file:
Code: Select all
@echo.
@echo IP INFORMATION
@ipconfig /all | find "IP Address"
@ipconfig /all | find "IPv4 Address"
@ipconfig /all | find "Subnet Mask"
@ipconfig /all | find "Default Gateway"
@ipconfig /all | find "Host Name"
@ipconfig /all | find "DNS Suffix Search List"
@ipconfig /all | find "Physical Address"
@ipconfig /all | find "DHCP Enabled"
@ipconfig /all | find "DHCP Server"
@ping 127.0.0.1
@echo.
@pause
Code: Select all
IP INFORMATION
IPv4 Address. . . . . . . . . . . : 192.168.168.9(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.168.168
Host Name . . . . . . . . . . . . : Docfxit
Physical Address. . . . . . . . . : 0A-00-27-00-00-0E
DHCP Enabled. . . . . . . . . . . : No
Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Press any key to continue . . .
The Problem machine has an environment variable PATH:
Code: Select all
C:\Programs\cygwin\bin;C:\Programs\cygwin;C:\Programs\cygwin\usr\local\bin\perl\site\bin;C:\Programs\cygwin\usr\local\bin\perl\bin;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0;C:\Program Files\ThinkPad\Bluetooth Software;C:\Program Files\Lenovo\Fingerprint Manager Pro;C:\Program Files\Intel\WiFi\bin;C:\Programs\Intel Management Engine Components\DAL;C:\Programs\Intel Management Engine Components\IPT;%SystemRoot%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Programs\Bitvise SSH Client;C:\Programs\Network Monitor 3\;C:\Program Files\HP\Digital Imaging\bin\Qt\Qt 4.3.3;C:\Programs\UltraEdit;C:\Programs\AudacitySoundConversionsox-14-4-2;%SystemRoot%\System32\WindowsPowerShell\v1.0\;C:\Programs\Client Access\Emulator;C:\Programs\Client Access\Shared;C:\Programs\Client Access\;C:\Program Files\Windows Imaging\;C:\Program Files\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Admin Arsenal\PDQ Deploy\;C:\Programs\PDQ Inventory\;C:\Program Files\Intel\UCRT\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\
Code: Select all
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
Code: Select all
C:\Dnload\9xAddons\Batch>path
PATH=C:\Programs\cygwin\bin;C:\Programs\cygwin;C:\Programs\cygwin\usr\local\bin\
perl\site\bin;C:\Programs\cygwin\usr\local\bin\perl\bin;C:\Program Files\Common
Files\Oracle\Java\javapath;C:\Program Files\Intel\Intel(R) Management Engine Com
ponents\iCLS\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Intel\iCLS Cl
ient\;C:\Program Files\Intel\iCLS Client;C:\Windows\system32;C:\Windows;C:\Windo
ws\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Thi
nkPad\Bluetooth Software;C:\Program Files\Lenovo\Fingerprint Manager Pro;C:\Prog
ram Files\Intel\WiFi\bin;C:\Programs\Intel Management Engine Components\DAL;C:\P
rograms\Intel Management Engine Components\IPT;C:\Windows\System32\WindowsPowerS
hell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\
WirelessCommon;C:\Programs\Bitvise SSH Client;C:\Programs\Network Monitor 3\;C:\
Program Files\HP\Digital Imaging\bin\Qt\Qt 4.3.3;C:\Programs\UltraEdit;C:\Progra
ms\AudacitySoundConversionsox-14-4-2;C:\Windows\System32\WindowsPowerShell\v1.0\
;C:\Programs\Client Access\Emulator;C:\Programs\Client Access\Shared;C:\Programs
\Client Access\;C:\Program Files\Windows Imaging\;C:\Program Files\Windows Kits\
8.1\Windows Performance Toolkit\;C:\Program Files\Common Files\Intel\WirelessCom
mon\;C:\Program Files\Admin Arsenal\PDQ Deploy\;C:\Programs\PDQ Inventory\;C:\Pr
ogram Files\Intel\UCRT\;C:\Program Files\Intel\Intel(R) Management Engine Compon
ents\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Pro
gram Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C
:\Programs\Python\Python37-32\Scripts\;C:\Programs\Python\Python37-32\;C:\Progra
ms\Nmap;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\Wir
elessCommon\
Code: Select all
C:\>Dir /s ipconfig.exe
Volume in drive C is Windows 7
Volume Serial Number is 5CC2-21B0
Directory of C:\Windows\System32
07/13/2009 06:14 PM 27,136 ipconfig.exe
1 File(s) 27,136 bytes
Directory of C:\Windows\winsxs\x86_microsoft-windows-ipconfig_31bf3856ad364e35_
6.1.7600.16385_none_4c104723794237c2
07/13/2009 06:14 PM 27,136 ipconfig.exe
1 File(s) 27,136 bytes
Total Files Listed:
2 File(s) 54,272 bytes
0 Dir(s) 2,689,814,528 bytes free
It has the same problem with the windows firewall turned on or not.
It has the same problem with my Antivirus turned on or not. Both machines have the same antivirus.
I have Windows Defender turned off.
Both machines are running with the same user with administrator privileges.
Does anyone have any idea why Ipconfig.exe doesn't pipe the output to the find correctly?
Thanks,
Docfxit