Can Someone Help me Write a Script


  1. Posts : 111
    Windows 10 Pro 21H1
       #1

    Can Someone Help me Write a Script


    I use an old kvm switch without active ddc so I am always having to open screen resolution settings and click detect.
    I would like to make a script file and then a shortcut to the file to do this for me but I have never written a script and can't figure out how to do it. Also, do I need to have a program in order for the script file to work. Can one of you tell me how I might accomplish this. Thanks
      My Computer


  2. Posts : 757
    Host W8.0 x64 Guest W10 x86
       #2

    DonationCoder.com has a sub-forum dedicated to just these small requests called Coding Snacks. You may submit your request here:
    Post New Requests Here - DonationCoder.com

    Please read the rules before posting. But the type of thing you are talking about should be quite easy. Also you may wish to read about DonationCoder here:
    DonationCoder.com

    Donations are encouraged but voluntary. If you have any questions about signing up or using the site contact Mouser.
      My Computer


  3. Nus
    Posts : 242
    Win 10 Pro 64bit
       #3

    lgentry said:
    I use an old kvm switch without active ddc so I am always having to open screen resolution settings and click detect.
    I would like to make a script file and then a shortcut to the file to do this for me but I have never written a script and can't figure out how to do it. Also, do I need to have a program in order for the script file to work. Can one of you tell me how I might accomplish this. Thanks
    If you don't know how to program then it would probably be to complicated to do that for your first script.

    Check you have Windows Powershell installed, it should be listed on the Start menu, and I'll see if I can knock something up for you.
      My Computer


  4. Posts : 111
    Windows 10 Pro 21H1
    Thread Starter
       #4

    Yes, I have powershell. I REALLY appreciate your time and effort.
      My Computer


  5. Nus
    Posts : 242
    Win 10 Pro 64bit
       #5

    As I can't replicate the same issue you've got this may need tweaking for your system, so report back.

    Rather than open the Control Panel Display properties and clicking detect, this uses the Windows API to detect display devices.

    There's a powershell script with the code and a batch file to run the script without having to change your system execution policies. You can place these files wherever you want but you will have to edit the .bat file and put in a new location. As it is, I've set it to run from C:\Program Files\Detect. So create this folder and put the two files in it. You can then create a shortcut to the .bat file on your Desktop.

    Detect.zip
      My Computer


  6. Posts : 111
    Windows 10 Pro 21H1
    Thread Starter
       #6

    Nus, this did not work for me but DonationCoder told me that a simple shortcut with the following as target
    will "detect display" Hope someone else finds this and it is beneficial. Thank you so much for your time and effort., I don't know what I would do without all the help I receive from gurus such as yourself. I am really amazing how many people across the web give of themselves to assist strangers. Good will is alive and well in the computing world.

    %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -noprofile -executionpolicy bypass -Command "Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorBasicDisplayParams | Out-Null"

    edit 7/23/15 I forgot to add that this shortcut must be "run as administrator"
    Last edited by lgentry; 23 Jul 2015 at 11:24. Reason: additional information
      My Computer


  7. Posts : 14,046
    Windows 11 Pro X64 22H2 22621.1848
       #7

    What does it do for you? I ran it just for kicks and it took 5 seconds or so then exited but I could not detect anything happening, probably because my resolution was already correct.
      My Computers


  8. Nus
    Posts : 242
    Win 10 Pro 64bit
       #8

    lgentry said:
    Nus, this did not work for me but DonationCoder told me that a simple shortcut with the following as target
    will "detect display" Hope someone else finds this and it is beneficial. Thank you so much for your time and effort., I don't know what I would do without all the help I receive from gurus such as yourself. I am really amazing how many people across the web give of themselves to assist strangers. Good will is alive and well in the computing world.

    %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -noprofile -executionpolicy bypass -Command "Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorBasicDisplayParams | Out-Null"
    No, worries, that looks like a simpler method, heh.

    I've got a script to set resolution, colour depth and refresh rate, so say if you need that.
      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 15:19.
Find Us




Windows 10 Forums