Search code examples
batch-filecmdwindows-server-2012-r2

Batch file The system cannot find the path specified


I am runnig below script to check soft installedo n my computer - windows 7

wmic product get name,version >%date%softwarelist.txt

It works and i am able to see the soft and ver that are saved on file with current date

But when i try to do the same on winServ2012R2 i got info - > The system cannot find the path specified.

What cause it and how to fix it ?


Solution

  • Here's a quick example:

    @Echo Off
    Set "MyDate="
    For /F "EOL=L" %%A In ('WMIC OS Get LocalDateTime'
    ) Do Set "MyDate=%%~nA" & GoTo :Break
    :Break
    If Not Defined MyDate Exit /B
    WMIC /Output:"%MyDate%SoftwareList.txt" Product Get Name,Version