How to use findstr on a hidden Ollama app.log file?


bacca400

Member
Local time
10:31 AM
Posts
3
OS
Windows 11
Background.

  1. I have a Desktop shortcut to open a cmd.exe window to the Ollama directory program. This shortcut also runs a .bat file to set up some paths and other environment variables.

The concept is simple. I want to search for the string OLLAMA_MODEL in the file `C:\Users\USERNAME\AppData\Local\Ollama` but the OS says it cannot find the file. The file appears to be hidden. I can use the File Explorer to open the directory. I'm the only user on this home machine so I'm also the admin.

I also tried copying the file to another directory but the error I get is "Cannot find file". So how do I search this file if I'm the admin user, to find the string I want?

My .bat file looks like this currently:

Code:
@echo off
rem Updated: 3/30/25
rem This file seems to be hidden: C:\Users\USERNAME\.ollama\models\app.log
set tfile=C:\Users\USERNAME\.ollama\models\app.log
set tfile2=.\app.log
copy %tfile% %tfile2%
if %ERRORLEVEL% NEQ 0  (
          echo ERROR: File could not be copied!
          goto myexit
)
findstr /i /n OLLAMA_MODEL %tfile2%
:myexit

This also gives me an error "File not found".

Code:
@echo off
rem Updated: 3/30/25
rem Ollama is in c:\users\USERNAME\AppData\Local\Programs\Ollama\
rem This file seems to be hidden: C:\Users\USERNAME\.ollama\models\app.log
set tfile=C:\Users\USERNAME\.ollama\models\app.log

dir /s /b /a:H %tfile% | findstr /i /c:"OLLAMA_MODEL: %tfile%
:myexit
 
Last edited:

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    HP Omen GT13-1xxx
    CPU
    AMD Ryzen 5 5600G with Radeon Graphics 6 cores
    Memory
    16GB
    Graphics Card(s)
    Nvideo GeForce RTX 3060
    Hard Drives
    C: SSD, with other hard drives from old PCs.
Is there also a missing closing quote for the search string "OLLAMA_MODEL: ?

Also, to try & copy the hidden file, first try and remove its Attributes with Attrib, then after the copy you can reverse the Attrib if required on the source/destination file.
try:
Code:
rem This file seems to be hidden: C:\Users\USERNAME\.ollama\models\app.log
set                tfile=C:\Users\USERNAME\.ollama\models\app.log
Attrib -R -A -S -H C:\Users\USERNAME\.ollama\models\app.log
set tfile2=.\app.log
copy %tfile% %tfile2%
if %ERRORLEVEL% NEQ 0  (
          echo ERROR: File could not be copied!
          goto myexit
)
findstr /i /n OLLAMA_MODEL %tfile2%
:myexit
 
Last edited:

My Computer

System One

  • OS
    Windows 11 23H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    custom
    CPU
    intel i7-8700 (non-K)
    Motherboard
    Asus Z370 TUF Gaming
    Memory
    32Gb
    Graphics Card(s)
    On-board Intel iGPU
    Sound Card
    On-board Realtek
    Hard Drives
    Samsung_SSD_850_EVO
    PSU
    Corsair Rm850X
    Cooling
    All air
  • Like
Reactions: OAT
Consider everything search, I find it invaluable for many searches. If finds hidden files just fine. It's fast and convenient.
 

My Computer

System One

  • OS
    Windows 11 Pro 24H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Home Brew
    CPU
    Intel Core i5 14500
    Motherboard
    Gigabyte B760M G P WIFI
    Memory
    64GB DDR4
    Graphics Card(s)
    GeForce RTX 4060
    Sound Card
    Chipset Realtek
    Monitor(s) Displays
    Two HP Pavilion 27xi 27"
    Screen Resolution
    1920x1080
    Hard Drives
    Crucial P310 2TB 2280 PCIe Gen4 3D NAND NVMe M.2 SSD
    Silicon Power 2TB US75 Nvme PCIe Gen4 M.2 2280 SSD
    Crucial BX500 2TB 3D NAND
    PSU
    Thermaltake Toughpower GF3 750W
    Case
    LIAN LI LANCOOL 216 E-ATX PC Case
    Cooling
    Lots of fans!
    Keyboard
    Microsoft Comfort Curve 2000
    Mouse
    Logitech G305
    Internet Speed
    Verizon FiOS 1GB
    Browser
    Firefox
    Antivirus
    Malware Bytes & Windows Security

My Computers

System One System Two

  • OS
    Windows 11 Pro for Workstations
    Computer type
    Laptop
    Manufacturer/Model
    ASUSTeK COMPUTER INC. TUF Gaming FX705GM
    CPU
    2.20 gigahertz Intel i7-8750H Hyper-threaded 12 cores
    Motherboard
    ASUSTeK COMPUTER INC. FX705GM 1.0
    Memory
    24428 Megabytes
    Graphics Card(s)
    Intel(R) UHD Graphics 630 / NVIDIA GeForce GTX 1060
    Sound Card
    Intel(R) Display Audio / Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (17.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9
    Hard Drives
    2 SSD SATA/NVM Express 1.3
    WDS500G2B0A-00SM50 500.1 GB
    WDCSDAPNUW-1002 256 GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & IGB Orange-fr
    Browser
    Edge Canary- Firefox Nightly-Chrome Dev-Chrome Dev
    Antivirus
    Windows Defender
    Other Info
    VMs of Windows 11 stable/Beta/Dev/Canary
    VM of XeroLinux- Arch based & Debian 13 (Trixie)
  • Operating System
    Windows 11 Insider Canary
    Computer type
    Laptop
    Manufacturer/Model
    ASUS X751BP
    CPU
    AMD Dual Core A6-9220
    Motherboard
    ASUS
    Memory
    8 GB
    Graphics card(s)
    AMD Radeon R5 M420
    Sound Card
    Realtek
    Monitor(s) Displays
    17.3
    Screen Resolution
    1600X900 16:9
    Hard Drives
    1TB 5400RPM
The OP is asking not only to find a file but a string within that file.
Everything search will also search file contents.
 

My Computer

System One

  • OS
    Windows 11 Pro 24H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Home Brew
    CPU
    Intel Core i5 14500
    Motherboard
    Gigabyte B760M G P WIFI
    Memory
    64GB DDR4
    Graphics Card(s)
    GeForce RTX 4060
    Sound Card
    Chipset Realtek
    Monitor(s) Displays
    Two HP Pavilion 27xi 27"
    Screen Resolution
    1920x1080
    Hard Drives
    Crucial P310 2TB 2280 PCIe Gen4 3D NAND NVMe M.2 SSD
    Silicon Power 2TB US75 Nvme PCIe Gen4 M.2 2280 SSD
    Crucial BX500 2TB 3D NAND
    PSU
    Thermaltake Toughpower GF3 750W
    Case
    LIAN LI LANCOOL 216 E-ATX PC Case
    Cooling
    Lots of fans!
    Keyboard
    Microsoft Comfort Curve 2000
    Mouse
    Logitech G305
    Internet Speed
    Verizon FiOS 1GB
    Browser
    Firefox
    Antivirus
    Malware Bytes & Windows Security
  • Helpful
Reactions: OAT
Last edited:

My Computers

System One System Two

  • OS
    Windows 11 Pro for Workstations
    Computer type
    Laptop
    Manufacturer/Model
    ASUSTeK COMPUTER INC. TUF Gaming FX705GM
    CPU
    2.20 gigahertz Intel i7-8750H Hyper-threaded 12 cores
    Motherboard
    ASUSTeK COMPUTER INC. FX705GM 1.0
    Memory
    24428 Megabytes
    Graphics Card(s)
    Intel(R) UHD Graphics 630 / NVIDIA GeForce GTX 1060
    Sound Card
    Intel(R) Display Audio / Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (17.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9
    Hard Drives
    2 SSD SATA/NVM Express 1.3
    WDS500G2B0A-00SM50 500.1 GB
    WDCSDAPNUW-1002 256 GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & IGB Orange-fr
    Browser
    Edge Canary- Firefox Nightly-Chrome Dev-Chrome Dev
    Antivirus
    Windows Defender
    Other Info
    VMs of Windows 11 stable/Beta/Dev/Canary
    VM of XeroLinux- Arch based & Debian 13 (Trixie)
  • Operating System
    Windows 11 Insider Canary
    Computer type
    Laptop
    Manufacturer/Model
    ASUS X751BP
    CPU
    AMD Dual Core A6-9220
    Motherboard
    ASUS
    Memory
    8 GB
    Graphics card(s)
    AMD Radeon R5 M420
    Sound Card
    Realtek
    Monitor(s) Displays
    17.3
    Screen Resolution
    1600X900 16:9
    Hard Drives
    1TB 5400RPM
Everything search will also search file contents.
But I want to find the string within the file and show that string, all in one step, a .bat file. The purpose of the batch file is to 1) not start another app, 2) find and display the directory where the Ollama models are stored.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    HP Omen GT13-1xxx
    CPU
    AMD Ryzen 5 5600G with Radeon Graphics 6 cores
    Memory
    16GB
    Graphics Card(s)
    Nvideo GeForce RTX 3060
    Hard Drives
    C: SSD, with other hard drives from old PCs.
Back
Top Bottom