how to execute a batch when computer is on IDLE

Page 3 of 7 FirstFirst 12345 ... LastLast

  1. Posts : 16,950
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #21

    m18xr2 said:
    im not sure what else to do at this point.
    I was wondering if some alternative approach could be built up -

    Try3 said:
    If you detected that you were connected to a network [a condition that TS can check] but it wasn't working properly [could not actually access a website], would that accurately describe your problem? If so, we could build on that idea.

    Denis
      My Computer


  2. Posts : 1,211
    Windows 10
       #22

    m18xr2 said:
    honestly im not sure what else to do at this point.
    Well that is because you are trying to band aid the situation its not going to improve by trying to side step the situation. I still think that you are trying to engineer a fix instead of actually trying to fix the issue.

    Elaborate the situation more. Reading back over the thread i noticed some things that i think warrant more detail.

    - So you reinstall the OS each time you try a driver if the computer gives issues with that driver? and the computer continues to blue screen across new installs?

    - You mention multiple adapters so you are trying the normal eth port and a wireless lan adapter or something? at different times and both present the exact same issues? the problems persist over both adapters?

    - How do you know exactly that its the network adapters causing problems? Have you been reading logs? Have you been checking that these adapters are producing error codes?

    Explain the adapters you are using, how many you have etc. Try to narrow it down to one adapter because it just complicates the situation otherwise.
    You also don't need to keep reinstalling windows you can delete the driver from windows/system32/drivers or you can disable or uninstall it in device manager where you can also get the name of the driver in question if you need to.

    - Are you using blck overclocking at all? if so turn it off and test at defaults.

    7 layers in the ip stack so i would suggest reseting the stack but you mention over windows installs so this is less relevant. The internet dropping out could also be on the router side have you been experiencing this on other devices or just the one computer?
      My Computer


  3. Posts : 181
    10, server 2016, server2012
    Thread Starter
       #23

    Malneb said:
    Well that is because you are trying to band aid the situation its not going to improve by trying to side step the situation. I still think that you are trying to engineer a fix instead of actually trying to fix the issue.

    Elaborate the situation more. Reading back over the thread i noticed some things that i think warrant more detail.

    - So you reinstall the OS each time you try a driver if the computer gives issues with that driver? and the computer continues to blue screen across new installs?

    - You mention multiple adapters so you are trying the normal eth port and a wireless lan adapter or something? at different times and both present the exact same issues? the problems persist over both adapters?

    - How do you know exactly that its the network adapters causing problems? Have you been reading logs? Have you been checking that these adapters are producing error codes?

    Explain the adapters you are using, how many you have etc. Try to narrow it down to one adapter because it just complicates the situation otherwise.
    You also don't need to keep reinstalling windows you can delete the driver from windows/system32/drivers or you can disable or uninstall it in device manager where you can also get the name of the driver in question if you need to.

    - Are you using blck overclocking at all? if so turn it off and test at defaults.

    7 layers in the ip stack so i would suggest reseting the stack but you mention over windows installs so this is less relevant. The internet dropping out could also be on the router side have you been experiencing this on other devices or just the one computer?
    I feel it is pointless to explain what I have been through hundreds of hours of troubleshooting, testing various adapters, drivers etc. I know what I'm doing and I also know what I am lacking. It is easy to know the cause after many years when the crashes happen often when I turn on torrent, or use firewall to regulate program access to internet and it always crashes with same message tcpip.sys driver IRQL less or equal to etc.

    If you can troubleshoot and read into dump files, and pinpoint directly to the cause I'd be much more inclined to provide more info, and spend more time once again to test various thing that I haven't tested before. but since I have doubt (and I'm not trying to be rude), it is pointless to answer your question that would be likely be non helpful to my quest of getting what I want, especially I have already answered in extended details on my earlier post.

    its everywhere I go on forum there are always people asking a ton of questions, whether relevant or irrelevant, to tell you what you should and should not do, while not providing any actual solution. sorry if I come off rude again, but if you are as technical as this guy thats posted here Question - Frequent BSOD crashing with different reason each time ? | Tom's Hardware Forum I honestly dont think you will be able to help me and I'd rather save time to get what I needed, which is have adapter reset itself when idling and that WILL get great result from my experience of using the same adapter for years.
      My Computer


  4. Posts : 1,211
    Windows 10
       #24

    Well if you knew what you were doing then you would not be trying to band aid the situation with something that is irrelevant. We cannot help you if you don't help yourself. That means filling in information that helps people outside of you to understand what your issue is. That means answering questions when people ask, if they ask for more info then try to elaborate otherwise there is no point trying to help you.

    Again have you been reading logs? how do you even know what the adapter is erroring? are you reading the blue screens
    leave the attitude behind tbh no one has to offer assistance to you because its your problem.

    The reason i am offering open ended advice is because the net stack is 7 layers which means there is room for things to get complicated fast.

    The other fact is it might not even be the adapter causing the issue you have provided nothing that actually says its the adapter other than your own line of thinking. The fact that you mention trying several adapters means that its very likely not the adapter/s lol. I mean come on don't come in here with that poor attitude thanks.

    I guess the logic here is that someone who thinks they need to reinstall windows each time they try a new driver is trying to tell me i don't know anything go figure.
    Last edited by Malneb; 16 Nov 2023 at 21:12.
      My Computer


  5. Posts : 181
    10, server 2016, server2012
    Thread Starter
       #25

    Malneb said:
    Well if you knew what you were doing then you would not be trying to band aid the situation with bandaid
    clearly you did not read what I've said. theres obviously a difference between completely understand whats causing the issue and a workaround that is suitable.

    at this point you are arguing for the sake to win an online argument, so I will stop conversing with you from this point on. Unless you're willing to help which I doubt, then again refer to my earlier post of people that ask a bunch of question and telling you what you should and should not do while not providing anyhelp, you definitely belong to this group.

    suggestion is okay, though whether I try them is optional based on how logical and practical I think the suggestions are. But it is clear of me using my computer for over 8 years and I will know more about this PC than you will of its issue.
      My Computer


  6. Posts : 16,950
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #26

    So, can we now pick up from post #21 and define the fault symptom that we're trying to deal with.
    As I suggested there, I think what you've said is that you are connected to the internet and find that you cannot access websites despite Window still showing you as connected.
    That condition can be detected and acted upon.


    All the best,
    Denis
      My Computer


  7. Posts : 181
    10, server 2016, server2012
    Thread Starter
       #27

    Try3 said:
    I think what you've said is that you are connected to the internet and find that you cannot access websites despite Window still showing you as connected.
    That condition can be detected and acted upon.
    That is definitely one of the issue im having, overall I'd say BSOD caused by drivers with prolong usage is a much bigger problem. when I can't access site even though window says internet is connected, I try 2-3 sites and if they all don't work then I can manually reset the adapter, which I already have a batch file to do that, a minor inconvenience but at most 3 seconds wait of a single click.

    with many other adapters I've tried, along with different version of drivers (including the default WLAN card and ethernet), they all crash very frequently (sometimes within minutes after rebooting a computer from previous BSOD crash), and those resetting network adapter doesn't do a thing.

    however with my current USB WIFI/BT adapter, I am getting way less frequent and In fact reseting it prolongs the crash (after using it for about 1.5 years ish). so I want it to be reset while computer is idle, mostly for when im away for several hours or sleping, which isn't working with the task scheduler.
      My Computer


  8. Posts : 16,950
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #28

    I suggest you add this to your batch file as a decision mechanism, a program flow control mechanism.
    - It's the same test that Windows uses from time to time, albeit not using a batch file.
    - I've remarked out but not deleted my own notes in the script.
    - I don't bother with @Echo Off because I set up all scripts like this to run minimised so I do not care what gets displayed during successful runs and like everything to be visible if I choose to look at it during unsuccessful runs.
    - I suggest you keep using the task you've set up in TS to initiate this batch file when Idle. You'll need to add to the Properties, Conditions tab Start only if the following network connection is available - Any connection so that your batch file only runs when Windows believes it has a network connection.

    Code:
    :: Initialisation
    Prompt $g
    Set WWWConnection=Off
    Set OutputFolder=%Temp%
    Set OutputFile=%Random%-WWWConnection-TestResults
    Set /a TestCounter=0
    
    :DoTheTest
    :: Run test 3 times if connection appears to be off in case it was a duff result [seen at least once]
    Set /a TestCounter=%TestCounter%+1
    powershell -Command "Invoke-WebRequest http://www.msftconnecttest.com/connecttest.txt -OutFile %OutputFolder%\%OutputFile%"
    dir "%OutputFolder%\%OutputFile%"
    If %ErrorLevel% GTR 0 (Set WWWConnection=Off) & (If %TestCounter% LSS 3 GoTo DoTheTest)
    If %ErrorLevel% EQU 0 (Set WWWConnection=On) & (del "%OutputFolder%\%OutputFile%")
    
    ::Detect the result
    If "%WWWConnection%"=="On" GoTo EndWWWConnectionTest
    ::::: This is where you add the code for resetting your network adapter i.e. your existing batch file
    
    
    :EndWWWConnectionTest
    Pause at the end during testing - WWWConnection is %WWWConnection%
    :: The batch file now closes of its own accord
    
    :: Notes
    :: If there is an internet connection, the output file is created
    :: If there is no internet connection, the output file is initially created but is deleted by powershell when it generates its failure response.  
    :: If you were to run this non-minimised, you would see some red text as it failed to find the www.msftconnecttest.com/connecttest.txt file

    If you want to play with it manually to see what the batch file is based on, you can put the path in your browser's address bar and you'll see the [mundane] contents of the connecttest.txt file
    http://www.msftconnecttest.com/connecttest.txt


    I know you have already written your resetting code. In case you are interested in a comparison, here is mine.
    - This code needs to be run as Admin which means the whole batch file it is in needs to be run as Admin which means that TS must be set up to run the batch file task as Admin.
    - Stage 1 discovers the name of the WiFi adapter [as shown in, for example, the Network & sharing centre, Adapter settings]. This assumes you only have one WiFi adapter [One enabled one that is. If you have others that have been disabled in the Bios or in Device manager I don't think that would be a problem.]
    - Stage 2 uses that name to disable then re-enable the adapter
    Code:
    prompt $g
    Set /a Found=0
    set FindString=Name
    Set UseExpresssion=netsh wlan show interfaces 
    
    for /F "tokens=*" %%X IN ('%UseExpresssion%  ^|   find /i "%FindString%"') do Call :Interfaces "%%X"
    GoTo EndGetWiFi
    
    :Interfaces
    Set ThisLine=%~1
    Set AdapterName=%ThisLine:*: =%
    GoTo :EOF
    
    :EndGetWiFi
    
    :: Do the disabling-enabling
    netsh interface set interface "%AdapterName%" disabled
    netsh interface set interface "%AdapterName%" enabled
    ::Pause to check outcome during testing


    All the best,
    Denis
      My Computer


  9. Posts : 1,211
    Windows 10
       #29

    m18xr2 said:
    clearly you did not read what I've said. theres obviously a difference between completely understand whats causing the issue and a workaround that is suitable.

    at this point you are arguing for the sake to win an online argument, so I will stop conversing with you from this point on. Unless you're willing to help which I doubt, then again refer to my earlier post of people that ask a bunch of question and telling you what you should and should not do while not providing anyhelp, you definitely belong to this group.

    suggestion is okay, though whether I try them is optional based on how logical and practical I think the suggestions are. But it is clear of me using my computer for over 8 years and I will know more about this PC than you will of its issue.
    You have a bad attitude and seem to like making assumptions. Why tf would i even be posting in here asking you things? if i did not want to spend my time trying to help/

    - Thinks they need to reinstall windows each time they install a new driver

    - Has shown no grounds that actually elaborate their line of thinking for the issue

    - Makes assumptions and tries to talk for people.

    - Overall bad attitude and undermining energy

    - Asks for help and when people are asking relevant questions, they decide it does not fit their terms because they already think they know what they want to hear.

    Yeah ok mate not my problem, when you come in here and try to coerce the thread into your pigeon hole and then actually provide no information at all that shows your line of thinking for the issue at hand, then people are going to ask you to elaborate. Why exactly do you think the adapters are the issue? Where is that data? like come on mate.

    You just keep trying to band aid your issue, like why do you even think its remotely the right idea? You do you i guess. You are trying to duct tape the situation at best have fun with that.
      My Computer


  10. Posts : 181
    10, server 2016, server2012
    Thread Starter
       #30

    Try3 said:
    I suggest you add this to your batch file as a decision mechanism, a program flow control mechanism.
    - It's the same test that Windows uses from time to time, albeit not using a batch file.
    - I've remarked out but not deleted my own notes in the script.
    - I don't bother with @Echo Off because I set up all scripts like this to run minimised so I do not care what gets displayed during successful runs and like everything to be visible if I choose to look at it during unsuccessful runs.
    - I suggest you keep using the task you've set up in TS to initiate this batch file when Idle. You'll need to add to the Properties, Conditions tab Start only if the following network connection is available - Any connection so that your batch file only runs when Windows believes it has a network connection.

    Code:
    :: Initialisation
    Prompt $g
    Set WWWConnection=Off
    Set OutputFolder=%Temp%
    Set OutputFile=%Random%-WWWConnection-TestResults
    Set /a TestCounter=0
    
    :DoTheTest
    :: Run test 3 times if connection appears to be off in case it was a duff result [seen at least once]
    Set /a TestCounter=%TestCounter%+1
    powershell -Command "Invoke-WebRequest http://www.msftconnecttest.com/connecttest.txt -OutFile %OutputFolder%\%OutputFile%"
    dir "%OutputFolder%\%OutputFile%"
    If %ErrorLevel% GTR 0 (Set WWWConnection=Off) & (If %TestCounter% LSS 3 GoTo DoTheTest)
    If %ErrorLevel% EQU 0 (Set WWWConnection=On) & (del "%OutputFolder%\%OutputFile%")
    
    ::Detect the result
    If "%WWWConnection%"=="On" GoTo EndWWWConnectionTest
    ::::: This is where you add the code for resetting your network adapter i.e. your existing batch file
    
    
    :EndWWWConnectionTest
    Pause at the end during testing - WWWConnection is %WWWConnection%
    :: The batch file now closes of its own accord
    
    :: Notes
    :: If there is an internet connection, the output file is created
    :: If there is no internet connection, the output file is initially created but is deleted by powershell when it generates its failure response.  
    :: If you were to run this non-minimised, you would see some red text as it failed to find the www.msftconnecttest.com/connecttest.txt file

    If you want to play with it manually to see what the batch file is based on, you can put the path in your browser's address bar and you'll see the [mundane] contents of the connecttest.txt file
    http://www.msftconnecttest.com/connecttest.txt


    I know you have already written your resetting code. In case you are interested in a comparison, here is mine.
    - This code needs to be run as Admin which means the whole batch file it is in needs to be run as Admin which means that TS must be set up to run the batch file task as Admin.
    - Stage 1 discovers the name of the WiFi adapter [as shown in, for example, the Network & sharing centre, Adapter settings]. This assumes you only have one WiFi adapter [One enabled one that is. If you have others that have been disabled in the Bios or in Device manager I don't think that would be a problem.]
    - Stage 2 uses that name to disable then re-enable the adapter
    Code:
    prompt $g
    Set /a Found=0
    set FindString=Name
    Set UseExpresssion=netsh wlan show interfaces 
    
    for /F "tokens=*" %%X IN ('%UseExpresssion%  ^|   find /i "%FindString%"') do Call :Interfaces "%%X"
    GoTo EndGetWiFi
    
    :Interfaces
    Set ThisLine=%~1
    Set AdapterName=%ThisLine:*: =%
    GoTo :EOF
    
    :EndGetWiFi
    
    :: Do the disabling-enabling
    netsh interface set interface "%AdapterName%" disabled
    netsh interface set interface "%AdapterName%" enabled
    ::Pause to check outcome during testing
    All the best,
    Denis
    these commands are powershell? or cmd?
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 11:54.
Find Us




Windows 10 Forums