locked
Why does my code open Notepad? (CLOSED) RRS feed

  • Question

  • I apologize for my ineptitude.  I am not a programmer, and all I want to do is get a list of records where position 35 is not a space.

    I know this is garbage code.  I admit I don't know what I'm doing.  

    Here is file out3.txt:

    Directory of C:\tmp\report scans\a 
    Directory of C:\tmp\report scans\b 
    Directory of C:\tmp\report scans\c 
    Directory of C:\tmp\report scans\c\a   <----------- All I want is to display this record.


    @echo off
    setlocal ENABLEDELAYEDEXPANSION
    cls
    echo got here1
    del out4.txt
    echo got here2
    for /f "tokens=*" %%i in ('out3.txt') do call :checker9           <------------this line of code opens out3.txt in Notepad

    :checker9
    echo got here3
    set check=!i:~36,1!
    echo got here4
    if %check% NEQ " " echo !i! >> out4.txt)


    • Edited by t5404tmz Friday, September 20, 2019 9:11 PM
    Friday, September 20, 2019 12:11 AM

Answers

  • for /f "tokens=*" %%I in ('type out3.txt') do call :checker9  

    \_(ツ)_/

    • Proposed as answer by jrv Friday, September 20, 2019 9:37 PM
    • Marked as answer by Richard MuellerMVP Friday, September 27, 2019 12:44 PM
    Friday, September 20, 2019 12:25 AM

All replies

  • for /f "tokens=*" %%I in ('type out3.txt') do call :checker9  

    \_(ツ)_/

    • Proposed as answer by jrv Friday, September 20, 2019 9:37 PM
    • Marked as answer by Richard MuellerMVP Friday, September 27, 2019 12:44 PM
    Friday, September 20, 2019 12:25 AM
  • Thanks!  That solves my Notepad problem.  Can I ask you how you would code something that will take out3.txt as input and display any records with a non-space in position 35?
    Friday, September 20, 2019 12:36 AM