Windows 7 creating blank txt file after running a batch script

kikirikoukiko

New member
Local time
3:04 AM
Messages
1
I have the following batch script

Code:
@echo off

    setlocal enableextensions

    set "baseName=dnshistory"

    set "count=0"
    for /f "delims=%baseName%." %%a in (
        'dir /b /o-d "%baseName%*.txt" 2^>nul'
    ) do ( set /a "count=%%a+1" & goto saveData )

:saveData
    ipconfig /displaydns | find "Record Name" > "%baseName%%count%.txt"

The problem is that when i run it on my windows 7 desktop, it creates an empty txt file in comparison to my windows 8 laptop, where it creates the dns record that i need.

Does anyone knows why this happens on windows 7 ?
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Samsung
OS
Windows 8.1 pro x64
Usually inserting a bunch of "echo" statements will give a hint what's wrong. Just like using MsgBox in other programming languages.
 

My Computer My Computer

Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
Are you running it from a Elevated Command Prompt? I think that's required.

Run ipconfig /displaydns | find "Record Name" and see if it works. Then try it from a Elevated Command Prompt.
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo IdeaCenter 450
OS
Windows 10 Pro X64
CPU
Intel Quad Core i7-4770 @ 3.4Ghz
Memory
16.0GB PC3-12800 DDR3 SDRAM 1600 MHz
Graphics Card(s)
Intel Integrated HD Graphics
Sound Card
Realtek HD Audio
Monitor(s) Displays
HP 22" LCD
Screen Resolution
1680 x 1050
Hard Drives
250GB Samsung EVO SATA-3 SSD
2TB Seagate ST2000DM001 SATA-2
1.5TB Seagate ST3150041AS SATA
Keyboard
Dell USB
Mouse
Lenovo USB
Internet Speed
Cable via Road Runner 3MB Upload, 30MB Download
Antivirus
Windows Defender, MBAM Pro, MBAE
Browser
Seamonkey
Other Info
UEFI/GPT
PLDS DVD-RW DH16AERSH
It works on my win7.
 

My Computers My Computers

System One System Two

  • Computer type
    PC/Desktop
    OS
    7 X64
    CPU
    i5 8400
    Motherboard
    gigabyte b365m ds3h
    Memory
    2x8gb 3200mhz
    Hard Drives
    various
    PSU
    pure power 11 400w cm
    Case
    Coolermaster
    Cooling
    cryorig m9i
  • Computer type
    PC/Desktop
    OS
    7x64
    CPU
    g5400
    Motherboard
    ga b365m ds3h
    Memory
    8gb ddr4 2400
    PSU
    xfx pro 450w
Back
Top