{"id":1416,"date":"2021-04-11T10:28:36","date_gmt":"2021-04-11T14:28:36","guid":{"rendered":"https:\/\/increasec.com\/?p=1416"},"modified":"2021-04-13T10:09:55","modified_gmt":"2021-04-13T14:09:55","slug":"batch-files-still-around","status":"publish","type":"post","link":"https:\/\/increasec.com\/?p=1416","title":{"rendered":"Batch files&#8230;still around"},"content":{"rendered":"\n<p>i used to use a program from the M$ powertools called sleep.exe but recently i found a native solution.   A ping to the loopback address takes a known amount of time and takes slightly less processing power than the old sleep.exe util.   <a href=\"https:\/\/ss64.com\/nt\/sleep.html\">credit source<\/a><\/p>\n\n\n\n<p>ping -n 120 127.0.0.1 1>nul<\/p>\n\n\n\n<p>I use this in my redo.bat that i now have memorized<\/p>\n\n\n\n<p>:start<br>%1 %2 %3 %4 %5 %6 %7 %8 %9<br>ping -n 120 127.0.0.1 1>nul<br>goto start<\/p>\n\n\n\n<p>this was originally conceived because ping fills the screen and is impossible to tell if it&#8217;s still scrolling or its paused.  but i found it useful for many other things.<\/p>\n\n\n\n<p>for sending email from scripts blat.exe has been replaced with <a href=\"https:\/\/github.com\/muquit\/mailsend-go\">mailsend-go<\/a>   Even tho it hates Gmail it works fine with M$.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Following is an example that sends me memory stats from an old snowflake server.   I still need a little help with the tail command, but i didn&#8217;t use too many brain cycles on this.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>set logfile=c:\\share\\hitask.log<br>echo &#8220;==============================================================&#8221; &gt;&gt; %logfile%<br>echo &#8220;==============================================================&#8221; &gt;&gt; %logfile%<br>date \/t &gt;&gt; %logfile%<br>wmic OS get FreePhysicalMemory &gt;&gt; %logfile%<br>tasklist \/FI &#8220;MEMUSAGE gt 100000&#8221; &gt;&gt; %logfile%<\/p>\n\n\n\n<p>rem make sure the log file doesn&#8217;t grow too large,   grrr doesn&#8217;t work right<br>: c:\\share\\tail -200 %logfile% > tmp%logfile%<br>: copy tmp%logfile% %logfile% -Y<\/p>\n\n\n\n<p>c:\\share\\mailsend-go -sub &#8220;VHG Term Svr Memory Report&#8221; -smtp smtp.office365.com -port 587 auth -user me@office.com -pass &#8220;ILikePie&#8221; -from &#8220;me@office.com&#8221; -to &#8220;me@office.com&#8221; -from &#8220;me@office.com&#8221; body -msg &#8220;A log file is attached&#8221; attach -file &#8220;c:\\share\\hitask.log&#8221;<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Example output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sry too many NUL characters in DOS output<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>i used to use a program from the M$ powertools called sleep.exe but recently i found a native solution. A ping to the loopback address takes a known amount of&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[165],"class_list":["post-1416","post","type-post","status-publish","format-standard","hentry","category-uncategorised","tag-script"],"_links":{"self":[{"href":"https:\/\/increasec.com\/index.php?rest_route=\/wp\/v2\/posts\/1416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/increasec.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/increasec.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/increasec.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/increasec.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1416"}],"version-history":[{"count":4,"href":"https:\/\/increasec.com\/index.php?rest_route=\/wp\/v2\/posts\/1416\/revisions"}],"predecessor-version":[{"id":1427,"href":"https:\/\/increasec.com\/index.php?rest_route=\/wp\/v2\/posts\/1416\/revisions\/1427"}],"wp:attachment":[{"href":"https:\/\/increasec.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/increasec.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/increasec.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}