Windows 10: Batch script does not work propperly

Discus and support Batch script does not work propperly in Windows 10 Ask Insider to solve the problem; Hello everybody, I've recently created a script which adds compatibility mode via CMD but I have problems getting it to work: REG ADD... Discussion in 'Windows 10 Ask Insider' started by /u/Alpha-Inc, Sep 11, 2020.

  1. Batch script does not work propperly


    Hello everybody,

    I've recently created a script which adds compatibility mode via CMD but I have problems getting it to work:

    REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "%CD%\mha2.exe" /t REG_SZ /d "WINXPSP3 256COLOR 640X480" /f

    mkdir Success (for testing only)

    exit

    When I execute the script by double clicking on it the directory success gets created but the compatibility mode is not set. It does not matter if I run the script with admin privileges or without. However, when I manually start the script via the command line (Only with admin privileges; I'm using start C:\Path\To\script.bat to start the script) the scripts does everything it should.

    Can someone help me why this is the case and tell me how to fix this?

    submitted by /u/Alpha-Inc
    [link] [comments]

    :)
     
    /u/Alpha-Inc, Sep 11, 2020
    #1
  2. yegorsw Win User

    Run the audio troubleshooter from a batch script

    I have an automated home theatre setup - a batch script that enables my TV as a display, and changes the TV to be my primary display (so games and apps open on my TV instead of my monitor).

    The same script also changes my default audio device to be the TV.

    The problem is every time I turn off my TV, it disappears from the list of audio output devices in Windows 10, and even when I turn it back on, it does not appear in the list. However, if I RIGHT CLICK on the audio icon and select "troubleshoot sound problems"
    and immediately cancel/close the troubleshooter, the TV is automagically added to my list of output devices.

    My question is - is there any way to have this troubleshooter be launched from a batch script and instantly closed? Alternatively, is there a way to force a refresh of the audio devices through a batch script?
     
    yegorsw, Sep 11, 2020
    #2
  3. Julivgar Win User
    Netfix Batch Script- Fix internet connection

    Somebody please try my batch script Netfix and leave feedback so I can improve it. thank you!

    My goal is to make a troubleshooter to help the built in "Windows Network Diagnostics" fix internet connection problems. How can you help?

    1. Download/copy the code on notepad then save as "Netfix.bat" or "Netfix.cmd"

    2. Test the Batch script

    3. Provide feedback and/or suggestions

    Thank you!
     
    Julivgar, Sep 11, 2020
    #3
  4. Batch script does not work propperly

    Running PowerShell script as a batch file

    Hello Baldo,



    Thank you for writing to Microsoft Community Forums.



    I understand that you want to execute the PowerShell commands as a batch file.



    I tried executing the batch file on my machine but I was unable to execute it as the command was incomplete. However, after making some changes in the command I was able to execute the batch file.



    You can try the following command by saving it in a batch file and check if that helps.



    powershell –Command Get-AppxPackage Microsoft.3dBuilder | Remove-AppxPackage



    Also, as the query is related to running a PowerShell script using a batch file, I suggest you to post the issue on

    TechNet
    forums where we have professionals who have more knowledge about the issue.



    Hope it helps.



    Regards,

    Prakhar Khare

    Microsoft Community – Moderator
     
    Prakhar_Khare, Sep 11, 2020
    #4
Thema:

Batch script does not work propperly

Loading...
  1. Batch script does not work propperly - Similar Threads - Batch script does

  2. Batch scripting

    in Windows 10 Software and Apps
    Batch scripting: Hi, here's the code that I used for 3 DISM commands to start automatically after pressing a key:Code and result:Code:@echo off echo You are going to use DISM. echo 1. To check the image. echo 2. Scan your PC's health echo 3. Restore your PC'S health. echo To continue, press...
  3. Batch scripting

    in Windows 10 Gaming
    Batch scripting: Hi, here's the code that I used for 3 DISM commands to start automatically after pressing a key:Code and result:Code:@echo off echo You are going to use DISM. echo 1. To check the image. echo 2. Scan your PC's health echo 3. Restore your PC'S health. echo To continue, press...
  4. Batch scripting

    in Windows 10 Network and Sharing
    Batch scripting: Hi, here's the code that I used for 3 DISM commands to start automatically after pressing a key:@echo off echo You are going to use DISM. echo 1. To check the image. echo 2. Scan your PC's health echo 3. Restore your PC'S health. echo To continue, press any key. echo Before...
  5. PageFile.sys batch script

    in Windows 10 Virtualization
    PageFile.sys batch script: Hello, I need help writing a batch script that would configure Windows Virtual Memory based on the amount of RAM installed If you have 4 GB of RAM, set virtual memory to 8 GB (Custom size: set both initial and maximum size to 8192) If you have 8 GB of RAM, set virtual memory...
  6. Batch Scripts / Programs.

    in Windows 10 Performance & Maintenance
    Batch Scripts / Programs.: The members and quests who use this forum know how professional, informative and helpful it is! In order to help members solve their problems/issues we often ask them to run certain programs and perform certain tasks and then upload [ post ] the results to the forum for us...
  7. Search is not working propperly

    in Windows 10 Ask Insider
    Search is not working propperly: Hi all, I am currently having the issue where I'd search for a certain part of a file's name (that I know is there) but Search doesn't bring it up. This is the situation: I have a folder full of Photoshop files and a certain part of them have either 'iPhone', 'Phone' or...
  8. Search is not working propperly

    in Cortana
    Search is not working propperly: Hi all, I am currently having the issue where I'd search for a certain part of a file's name that I know is there but Search doesn't bring it up. This is the situation: I have a folder full of Photoshop files and a certain part of them have either 'iPhone', 'Phone' or...
  9. Batch scripting problems

    in Windows 10 Ask Insider
    Batch scripting problems: So i found a bug. In batch scripting, I can only store 3 variables. I don't know the cause for this. Here's the code, if you need it. @ echo off title Elevator OS by Lackmey on YouTube and Reddit set gdata=No data found (this one works) set 1data=No data found (this one...
  10. Batch script question

    in Windows 10 Support
    Batch script question: Hello, I want make a batch script to delete a spefic folder on the C disk, but how can I get only that spefic folder? I got this: Code: FOR /D %%p IN ("C:\USERS\%USERNAME%\Downloads\*.*") DO rmdir "%%p" /s /q cd C:\USERS\%USERNAME%\Downloads\ del *.* /q /s timeout /t 5...