-1

I wrote a small program to check if my network is down it looks like this:

@echo off
set ipaddr=172.217.11.238
set oldstate=neither
:loop
set state=up
ping -n 1 !ipaddr! >nul: 2>nul:
if not !errorlevel!==0 set state=down
if not !state!==!oldstate! (
    echo.Link is !state!
    set oldstate=!state!
    start msg * "Network is !state!!"
)
ping -n 2 127.0.0.1 >nul: 2>nul:
goto :loop
endlocal

I put it in my startup folder C:\Users\Quadsam\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup after converting it to an exe and restarted my pc. The program works great but every once and a while it will pop up saying Network is Down! so i click ok but then it says Network is Up! and at seemingly random times it will pop up with those messages. So I got annoyed and went to delete it but it was gone! I have checked task manager and the program does not appear there. I have tried to install third party task managers but to no avail. I checked in the registry to see if there was any pointer to it in Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run. I have checked msconfig.exe and cant find it anywhere. Can anybody help me with this?

Quadsam
  • 3
  • 2
  • 1
    You stated that it wrks great, but I do not believe that's possible, unless you insert a new line `2`, `SetLocal EnableDelayedExpansion` – Compo Jun 17 '20 at 01:36
  • I cant get to the file to edit it. – Quadsam Jun 17 '20 at 01:39
  • 1
    It's right above, copy and paste it, and this time don't waste time hiding it inside an `.exe` file. Also, the `StartUp` directory isn't for the file itself, you should only place a shortcut to the file there. – Compo Jun 17 '20 at 01:44
  • 1
    What are you looking for in Task Manager? It's possible that the .exe you converted just extracted the batch file to a temp directory and ran it from there. In that case Task Manager would list it under `cmd`. – dxiv Jun 17 '20 at 03:28
  • 1
    Also are you sure that you really put your file inside `C:\Users\Quadsam\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup`, _(`shell:startup`)_, and not inside `C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp`, `shell:common startup`? One thing which is certain is that a file which does not exist, cannot run, and definitely not every time your PC is started. So if it's not in that location, try using the GUI search facility, or use the `Dir` or `Where` commands in your Command Prompt window. – Compo Jun 17 '20 at 10:32
  • I have checked all the startup folders – Quadsam Jun 17 '20 at 21:08

1 Answers1

0

Do you have the option to show hidden files turned on?

It is possible that the file could have been marked as system or hidden.

See here for instructions on showing hidden and/or system files.

Community
  • 1
  • 1
Delta
  • 444
  • 1
  • 4
  • 14