none
Cannot run .bat files on Windows 10 RRS feed

  • Question

  • Hi everyone,

    I wanted to set up a nice .bat file to do automatic backups to my Onedrive. But I'll pass quick on this specifically, as my problem is now going far beyond : I just can't run any .bat file now!

    About my system :

    I have Windows 10 Family with all the updates, as of this 13 of june, so this is version 1607. I'm protected with Avira, with the updates, but I have tried deactivating it, which doesn't change. I have also scanned my computer with this as well as Malwarebytes anti-malware, updated, with no detections.

    My exact problem :

    So, everything was going well as I tested a couple of times my original batch file, that was doing backups with an xcopy instruction. Trying to improve it, suddenly it stopped to run properly, showing for a minuscule fraction of a second then closing. So to check if I can still just run batch files, I tried different variations of the simplest batch files :

    First variation :

    ipconfig /all

    pause

    Second variation :

    cd c:\

    start Users

    pause

    Third variation :

    dir

    pause

    And... none of these batch files runs properly, ran As Administrator or not, and being in any location. This, even though these commands run effectively in a command prompt, as well. Also, I specify that my files are named correctly, with no space and have the correct .bat extension.

    What it does exactly :

    So, when double-clicking on any of those, or right-clicking and "Run as Administrator", a command prompt simply appears for a infime fraction of second, then closes, and this is it. I insist on the shortness of the delay, as I've already seen a command prompt with a /min instruction operating, and in my case the delay is really shorter, it's kind of like the command prompt program is blocked by something. But there is another characteristic : when I start my system, the very first time that I try to run a batch file, the delay before the closing of the command prompt is longer, maybe half a second, not long enough to let me see what appears in it though.

    Since I don't know to what this is related, I don't know much which other info I should give you... maybe help me with that too. Thanks in advance pals!


    • Edited by Znojmo Wednesday, June 14, 2017 2:42 AM
    • Moved by Bill_Stewart Wednesday, July 26, 2017 7:31 PM Unanswerable drive-by question
    Wednesday, June 14, 2017 2:39 AM

All replies

  • This is not really a scripting issue.  Group Policy can prevent running  bat files or something may have changed you system settings and the bat files are not associated with the correct program.  Ask you network Admins about this.


    \_(ツ)_/

    Wednesday, June 14, 2017 3:13 AM
  • You said you tried running the individual commands in the command prompt with success. Did you try navigating to the .bat file directory from within the cmd prompt and running the script from within the prompt? The cmd should remain open to display any possible issues. 

    Did you check the file association as well? It looks like its attempting to open a window but I would double check associations

    Wednesday, June 14, 2017 3:27 AM
  • Sorry guys this is miserable to answer so late, I didn't receive an answer notification so I assumed... too much!

    So, thank you both, as for the Group policy I don't know how to verify this...


    You said you tried running the individual commands in the command prompt with success. Did you try navigating to the .bat file directory from within the cmd prompt and running the script from within the prompt? The cmd should remain open to display any possible issues.

    So, I tried this and there may be a clue, look what it returns :

    C:\>□

    "□" is not recognized as an internal or external command, an executable command or a command file.


    except that :

    -"□" is an assumed wrong character, me being unable to reproduce what I see. What I see is a plain white square, which logically would be a plain black character, which I don't understand where it comes from. I swear this character is totally absent from my script, which in one of the versions I tried has simply the line "start Users", with no return at all!

    - this is a translation of my french version, which can differ a little bit from the english line, but shouldn't derive so much that the sense differs.

    Did you check the file association as well? It looks like its attempting to open a window but I would double check associations

    According to a solution I saw on superuser.com, in order to correct file association, I would have to play in the registry. But, in fact the cmd window opens when I double-click my .bat files, just that it opens abnormally fast, as I mentioned. So the file is already associated, right?




    • Edited by Znojmo Sunday, September 10, 2017 3:01 AM better formatting
    Sunday, September 10, 2017 2:58 AM