1.    14 Jul 2015 #1
    Join Date : Feb 2015
    Posts : 76
    Windows 10 Pro/8.1 Pro

    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 ComputerSystem Spec
  2.    14 Jul 2015 #2
    Join Date : Jan 2014
    Posts : 743
    Host W8.0 x64 Guest W10 x86

    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 ComputerSystem Spec
  3.    15 Jul 2015 #3
    Join Date : Jul 2015
    Posts : 243
    Win 10 Pro 64bit

    Quote Originally Posted by lgentry View Post
    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 ComputerSystem Spec
  4.    15 Jul 2015 #4
    Join Date : Feb 2015
    Posts : 76
    Windows 10 Pro/8.1 Pro
    Thread Starter

    Yes, I have powershell. I REALLY appreciate your time and effort.
      My ComputerSystem Spec
  5.    15 Jul 2015 #5
    Join Date : Jul 2015
    Posts : 243
    Win 10 Pro 64bit

    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 ComputerSystem Spec
  6.    19 Jul 2015 #6
    Join Date : Feb 2015
    Posts : 76
    Windows 10 Pro/8.1 Pro
    Thread Starter

    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 ComputerSystem Spec
  7.    19 Jul 2015 #7
    Join Date : Apr 2014
    Space coast of Florida
    Posts : 5,369
    Windows 10 Pro X64 16299.19

    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 ComputersSystem Spec
  8.    20 Jul 2015 #8
    Join Date : Jul 2015
    Posts : 243
    Win 10 Pro 64bit

    Quote Originally Posted by lgentry View Post
    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 ComputerSystem Spec

 


Similar Threads
Thread Forum
Hardware & Drivers Enable or Disable Disk Write Protection in Windows
How to Enable or Disable Write Protection for a Disk Drive in Windows Write protection (read-only) on a disk prevents the contents on the disk from being changed. There are many reasons for how a disk is write protected. This tutorial will...
Tutorials
Solved Installer doesn't have permission to write to the startmenu located..
Installer doesn't have permission to write to the startmenu located in C:\ProgramData\Start Menu Avg & some other software wouldn't install at all, tell I used the take ownership registry file. I also notice, Windows updates keep not...
General Support
Python Script for "Change A Letter Game [2] "...
Well, I just finished a script in Python to help select a new word for the Change a Letter Game. The inputs are 1) letter to skip and then the three letters to look for. So far it looks/works great and I plan on working on the code to add a...
Chillout Room
Diskpart: Media is write protected
Not a windows 10 specific question: I'm unable to perform "clean" command with diskpart on my USB memory stick. Getting a nice little error "DiskPart has encountered an error: The media is write protected." Checked disk attributes and...
Chillout Room
My Python script to play last letter game!!
5264 That's the GUI. I can post all of the code if anyone wants it. Jeff :)
Chillout Room
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 05:49.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums