Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Batch file help  (Read 2814 times)

0 Members and 1 Guest are viewing this topic.

doubleagent

    Topic Starter


    Greenhorn

    Thanked: 1
    Batch file help
    « on: June 01, 2009, 10:27:20 AM »
    I am trying to write a batch file that writes batch files, once you see the code you might see why i need a batch file to do this, the problem is that i want the batch files that i create to redirect their output to a text file, but i can't get the first batch file to redirect the redirect if that makes sense.

    here is the batch file i have right now:
    Code: [Select]
    @ echo off

    @set /p name=Enter computer name:
    @set /p low=Enter lowest computer number:
    @set /p high=Enter highest computer number:
    @set /p room=Enter room name or number:

    reM resetgenerator.bat namesch start end

    REM set /a result=%low%+1
    REM if %1 == "" GOTO ERROR
    set results=%low%
    mkdir %room%
    cd /%room%
    goto check

    :check
    IF %results% LEQ 9 goto make
    IF %results% GTR 9 goto shake

    :make
    set result=0%results%
    echo tasklist /s \\%name%%result% /fo LIST /fi "USERNAME ne NT AUTHORITY\SYSTEM" /fi "USERNAME ne NT AUTHORITY\LOCAL SERVICE" /fi "USERNAME ne NT AUTHORITY\NETWORK SERVICE" /fi "USERNAME ne N/A" /v >> %name%%result%.bat
    GOTO continue

    :shake
    echo tasklist /s \\%name%%results% /fo LIST /fi "USERNAME ne NT AUTHORITY\SYSTEM" /fi "USERNAME ne NT AUTHORITY\LOCAL SERVICE" /fi "USERNAME ne NT AUTHORITY\NETWORK SERVICE" /fi "USERNAME ne N/A" /v >> %name%%results%.bat
    goto continue

    :continue
    set /a results=%results%+1
    if %results% GTR %high% GOTO end
    goto check

    :end
    exit

    and this is what i want it to make:
    Code: [Select]
    tasklist /s \\nccaihg01 /fo LIST /fi "USERNAME ne NT AUTHORITY\SYSTEM" /fi "USERNAME ne NT AUTHORITY\LOCAL SERVICE" /fi "USERNAME ne NT AUTHORITY\NETWORK SERVICE" /fi "USERNAME ne N/A" /v > "c:\documents and settings\administrator\desktop\resets\tasks\list.txt"

    any help is appreciated