locked
Netstat and Tracert logging RRS feed

  • السؤال

  • How would I log the results of tracert and netstat? (separtate .bats and log files)
    Asking questions is the simplest way to Learn
    13/ذو القعدة/1432 08:28 ص

الإجابات

  • tracert google.com > c:\temp\log.txt



    If you found this post helpful, please "Vote as Helpful". If it answered your question, remember to "Mark as Answer"
    MCC & PowerShell enthusiast
    http://oliver.lipkau.net/blog
    • تم وضع علامة كإجابة بواسطة Oliver Lipkau 13/ذو القعدة/1432 01:31 م
    13/ذو القعدة/1432 08:37 ص

جميع الردود

  • tracert google.com > c:\temp\log.txt



    If you found this post helpful, please "Vote as Helpful". If it answered your question, remember to "Mark as Answer"
    MCC & PowerShell enthusiast
    http://oliver.lipkau.net/blog
    • تم وضع علامة كإجابة بواسطة Oliver Lipkau 13/ذو القعدة/1432 01:31 م
    13/ذو القعدة/1432 08:37 ص
  • Now how do I create a new log with the date and time in the name each time it is ran?
    Asking questions is the simplest way to Learn
    13/ذو القعدة/1432 08:45 ص
  • Now how do I create a new log with the date and time in the name each time it is ran?
    Asking questions is the simplest way to Learn
    This is called "scope creep": Adding a new requirement each time the previous question is answered. Are there other requirements you have? Since this is an FAQ, have you checked the script repository?
    13/ذو القعدة/1432 08:55 ص
  • This is called "scope creep": Adding a new requirement each time the previous question is answered. Are there other requirements you have? Since this is an FAQ, have you checked the script repository?

    I like the term "scope creep".  Robopwner, I think it would be best to start with a new question:

    "How do I create files with today's date and time as the filename"


    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"
    • تم التحرير بواسطة Bigteddy 13/ذو القعدة/1432 09:06 ص
    13/ذو القعدة/1432 09:06 ص
  • Ok, I thought that since it was dealing kinda with the question also but it doesn't hurt to ask.
    Asking questions is the simplest way to Learn
    14/ذو القعدة/1432 03:34 ص
  • Now how do I create a new log with the date and time in the name each time it is ran?
    Asking questions is the simplest way to Learn
    %date% and %time%
    If you found this post helpful, please "Vote as Helpful". If it answered your question, remember to "Mark as Answer"
    MCC & PowerShell enthusiast
    http://oliver.lipkau.net/blog
    14/ذو القعدة/1432 03:41 ص
  • Now how do I create a new log with the date and time in the name each time it is ran?
    Asking questions is the simplest way to Learn


    This will do the trick:

     

    @echo off
     for /f "tokens=1" %%i in ('date /t') do set todaydate=%%i
     set today=%todaydate:~6,4%-%todaydate:~3,2%-%todaydate:~0,2%
    
     for /f "tokens=1" %%i in ('time /t') do set todaytime=%%i
     set now=%todaytime:~0,2%%todaytime:~3,2%
    
    set datetime=%today%_%now%
    
    netstat > NS_%datetime%.txt
    tracert google.com > TR_%datetime%.txt
    
    

     


    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"

    • تم التحرير بواسطة Bigteddy 14/ذو القعدة/1432 06:16 ص
    14/ذو القعدة/1432 06:16 ص