none
How to code a batch file to set volume level?

    Question

  • Does anyone know any batch code to set the volumne at specific level? 

    Thanks in advance for any suggestions


    Thanks in advance for any suggestions
    Thursday, September 01, 2011 8:05 AM

Answers

  • Does anyone know any batch code to set the volumne at specific level? 

    Thanks in advance for any suggestions


    Thanks in advance for any suggestions


    PowerShell to the rescue.

    http://gallery.technet.microsoft.com/scriptcenter/PowerShell-Set-PC-Volume-1737b160

    I just uploaded this solution using PowerShell.  It can be called from a batch file using normal PowerShell calling methods. It can set teh master volume to any setting 0 to 65535.

    You can use Visual Studio or (Express) to create a custom program with this code that can set the volume directly.

     


    jv
    • Proposed as answer by Bigteddy Thursday, September 01, 2011 7:48 PM
    • Marked as answer by oem7110 Saturday, September 10, 2011 3:06 PM
    Thursday, September 01, 2011 4:41 PM

All replies

  • This is an old, oft asked question.  It seems like a simple request.  AFAIK it can't be done without a third party utility.  I believe that's intentional, as it could be very annoying to have a procedure run your volume to maximum without your knowledge.  There is almost certainly an OS API call that has that control, but there is no way to make API calls from batch.  Nor is there a WMI functionality to do this.  So, you can't use the wmic.exe utility.  You just need to do an internet search for a volume control utility.  I have seen such references, but have no recomendations.
    Tom Lavedas
    • Proposed as answer by Bigteddy Thursday, September 01, 2011 1:51 PM
    • Unproposed as answer by Bigteddy Monday, September 05, 2011 1:06 PM
    Thursday, September 01, 2011 1:13 PM
    Moderator
  • Does anyone know any batch code to set the volumne at specific level? 

    Thanks in advance for any suggestions


    Thanks in advance for any suggestions


    PowerShell to the rescue.

    http://gallery.technet.microsoft.com/scriptcenter/PowerShell-Set-PC-Volume-1737b160

    I just uploaded this solution using PowerShell.  It can be called from a batch file using normal PowerShell calling methods. It can set teh master volume to any setting 0 to 65535.

    You can use Visual Studio or (Express) to create a custom program with this code that can set the volume directly.

     


    jv
    • Proposed as answer by Bigteddy Thursday, September 01, 2011 7:48 PM
    • Marked as answer by oem7110 Saturday, September 10, 2011 3:06 PM
    Thursday, September 01, 2011 4:41 PM
  • As I said - it takes a third party utility.
    Tom Lavedas
    Thursday, September 01, 2011 4:44 PM
    Moderator
  • As I said - it takes a third party utility.
    Tom Lavedas


    Ahh! but with this the third party is you.  There is no control to install and nothing to purchases.  Just one PS1 PowerShell script contains everything you need. It just uses a custom type created on the fly which access the winmm.dll which is an Win32 API on every Windows box.  It canmanage all aspects of the media mixer and it is the foundation for the Sounds control panel applet.

    So you see.  There is nothing 'third party' about it.  The source was just borrowed form the SDK.  I used a published version and modified it to work with POwerSHell and to be independent of any external components.

     


    jv
    Thursday, September 01, 2011 5:08 PM
  • Ok, I still need to quibble in that the "type file" is NOT on the machine until it is downloaded from somewhere, unzipped and then called by your code.  That's still awfully close to a third party utility to me.


    Tom Lavedas
    Thursday, September 01, 2011 5:22 PM
    Moderator
  • Ok, I still need to quibble in that the "type file" is NOT on the machine until it is downloaded from somewhere, unzipped and then called by your code.  That's still awfully close to a third party utility to me.


    Tom Lavedas


    Sorry Tom - there is no type file to download.  It is just a PowerShell script file like any other.

     


    jv
    Thursday, September 01, 2011 5:25 PM
  • I get this when I try to run it:

    The current volume control setting is:-1
    Cannot Set Volume
    The current volume control setting is:-1
    Cannot Set Volume
    The current volume control setting is:-1
    Cannot Set Volume
    The current volume control setting is:-1

    I tried to run it elevated, but same thing.


    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"
    Thursday, September 01, 2011 5:32 PM
  • Not to be dense (though I clearly am).  When I try the first line of your script in PS, I get ...

    PS T:\>  Add-Type -path VolumeControl.cs
    Add-Type : Cannot bind parameter 'Path' to the target. Exception setting "Path": "Cannot find path 'T:\VolumeControl.cs' because it does not exist."

    So where does the VolumeControl.cs file come from?


    Tom Lavedas
    Thursday, September 01, 2011 5:38 PM
    Moderator
  • Tom, the file is downloadable as a .cs, but I think it should just work.  The c# code is written as a here-string in the ps script, and called with the line:

    Add-Type $code

    Correct me if I'm wrong, jv.


    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"
    Thursday, September 01, 2011 5:42 PM
  • I get this when I try to run it:

    The current volume control setting is:-1
    Cannot Set Volume
    The current volume control setting is:-1
    Cannot Set Volume
    The current volume control setting is:-1
    Cannot Set Volume
    The current volume control setting is:-1

    I tried to run it elevated, but same thing.


    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"


    As i noted in teh repository.  I have only tested this on WIndows XP.  On Win7 it needs to use the wide characcter calls I believe.  I will look at it later   Changing all of the'A's to 'W's should work.

     


    jv
    Thursday, September 01, 2011 5:48 PM
  • Ok, I didn't download the file, just cut and pasted the first line of the posted PS code.

    So, it is equivalent to an in-line coding.  I get it now, but it's still a bit more that 'a batch file'.

    I'll shut up now ;-)


    Tom Lavedas
    Thursday, September 01, 2011 5:49 PM
    Moderator
  • Tom, the file is downloadable as a .cs, but I think it should just work.  The c# code is written as a here-string in the ps script, and called with the line:

    Add-Type $code

    Correct me if I'm wrong, jv.


    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"


    Right again.  The code i posted her is just a teaser. It was intended to show how easily it can be done.  I did note that the zip had to be downloaded to get the compete solution in one file. I prefer teh external CS file as I can use it whemn needed very quickly an I don't need to use everything from a ps1 file.

     


    jv
    Thursday, September 01, 2011 5:50 PM
  • I get this when I try to run it:

    The current volume control setting is:-1
    Cannot Set Volume
    The current volume control setting is:-1
    Cannot Set Volume
    The current volume control setting is:-1
    Cannot Set Volume
    The current volume control setting is:-1

    I tried to run it elevated, but same thing.


    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"


    Are you NOT running in 32 bit mode?

    Win32 API is only available in 32 bit WIndows.  In 64 bit we have to call down.  The code in PowerShell (cs) is 23 bit so 64 bit vales may look like -1.

    Commnet out the try/catch and just leave the code in the try block.  See if it throws an exception.

     

     


    jv
    Thursday, September 01, 2011 6:24 PM
  • Works fine on Win7 32 bit.

    It just has an extra behavior.


    jv
    Thursday, September 01, 2011 6:42 PM
  • I commented out the Try Catch parts as you said, and then I get this: (Yes, I am running 64-bit Windows 7)

    PS C:\Scripts> .\volume.ps1
    The current volume control setting is:-1
    Exception calling "SetVolume" with "1" argument(s): "Cannot Set Volume"
    At C:\Scripts\volume.ps1:433 char:44
    + [PC_VolumeControl.VolumeControl]::SetVolume <<<< (0)
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException

    The current volume control setting is:-1
    Exception calling "SetVolume" with "1" argument(s): "Cannot Set Volume"
    At C:\Scripts\volume.ps1:436 char:44
    + [PC_VolumeControl.VolumeControl]::SetVolume <<<< (65535)
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException

    The current volume control setting is:-1
    Exception calling "SetVolume" with "1" argument(s): "Cannot Set Volume"
    At C:\Scripts\volume.ps1:439 char:44
    + [PC_VolumeControl.VolumeControl]::SetVolume <<<< ($VolumeLevel)
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException

    The current volume control setting is:-1


    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"
    Thursday, September 01, 2011 6:47 PM
  • It work fine in WIn7 32 bit.  It wil NOT work in 64 bit without cahnging the code.

    Maybe one day I will add code to detect the word size and call the appropriate APIs.  It also needs to tuse the extensions to winmm that allow it to be Win7/Vista aware as they both default ot only setting the applicaiotns copy of the volume control. XP/WS2003 and earlier only have one volume control for the session/profile.

    Run PowerShell in 32 bit mode and it should work.

     


    jv
    Thursday, September 01, 2011 7:03 PM
  • I believe you, jv.  But I've got a volume control in my task bar, I don't need to do it programatically!  If the OP is running 32 bit, then your solution is probably the answer.
    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"
    Thursday, September 01, 2011 7:48 PM
  • I am using Window XP with SP3, could you please give me any suggestions on how to run this code?

     Do I need to save it in batch file?


    Thanks in advance for any suggestions
    • Edited by oem7110 Friday, September 02, 2011 1:18 AM
    Friday, September 02, 2011 1:17 AM
  • I am using Window XP with SP3, could you please give me any suggestions on how to run this code?

     Do I need to save it in batch file?


    Thanks in advance for any suggestions


    Do you hace PowerShell installed?  It is optional on Windows XP.

     


    jv
    Friday, September 02, 2011 1:37 AM
  • I have installed powershell, and copy the following script into volume.ps1 file, I would like to set the default volume level at 10000, could you please give me any suggestions whether the coding looks correct to run under powershell or not?

    The current volume control setting is:-1
    Exception calling "SetVolume" with "1" argument(s): "Cannot Set Volume"
    At C:\Scripts\volume.ps1:439 char:44
    + [PC_VolumeControl.VolumeControl]::10000
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException

    The current volume control setting is:-1

     


    Thanks in advance for any suggestions
    Monday, September 05, 2011 11:44 AM
  • I have installed powershell, and copy the following script into volume.ps1 file, I would like to set the default volume level at 10000, could you please give me any suggestions whether the coding looks correct to run under powershell or not?

    The current volume control setting is:-1
    Exception calling "SetVolume" with "1" argument(s): "Cannot Set Volume"
    At C:\Scripts\volume.ps1:439 char:44
    + [PC_VolumeControl.VolumeControl]::10000
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException

    The current volume control setting is:-1

     


    Thanks in advance for any suggestions


    Please read the whole thread very carefully.  SOmewher ein tehinformation is the answer.  The information you haev given indicates that you are not on the correct OS.

     


    jv
    Monday, September 05, 2011 12:24 PM
  • jv, OP says he is on XP.  Isnt' that where your code is supposed to work?  You know I tried it and got the same error, but I'm running 7.

     


    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"
    Monday, September 05, 2011 12:28 PM
  • jv, OP says he is on XP.  Isnt' that where your code is supposed to work?  You know I tried it and got the same error, but I'm running 7.

     


    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"


    He is not on XP or on XP 64 bit or he is not running the command as insructeed.

    <path>\Set-PCVolume.ps1

    I don't know what is being copied into a file and saved.  The ZIP file caontains everything needed in one PS1 file.

     


    jv
    Monday, September 05, 2011 12:46 PM
  • OK, will download it again, and try it on my virtual XP machine.
    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"
    Monday, September 05, 2011 12:47 PM
  • OK, will download it again, and try it on my virtual XP machine.
    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"

    It also may not work if you use ceration third party sound system replacements.  Only Microsoft compliant sound systems will allow API control.

     


    jv
    Monday, September 05, 2011 12:50 PM
  • I tested it on my virtual XP machine, and it works fine.
    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"
    Monday, September 05, 2011 1:04 PM
  • I tested it on my virtual XP machine, and it works fine.
    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"


    Hey - When I build it it works.

    There is NO simpl esolution for Vista and later.  I can do it but then I ask ... Why?

     


    jv
    Monday, September 05, 2011 1:20 PM
  • Yes, and because it works, and doesn't use any third-party utils or code, I un-marked Tom's as a proposed answer.  The answer is, yes you can set the volume programatically under XP with your code, but, like you say, Why?  It's not like you are fixing it at that level.  The user can still change it after the code has run.

    Sometimes I think we let ourselves get caught up in wild goose-chases (or is that wild-geesechase?)


    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"

    • Edited by Bigteddy Monday, September 05, 2011 1:37 PM
    Monday, September 05, 2011 1:36 PM
  • I get following error when I run the coding.

    Does anyone have any suggestions?

    Thanks everyone very much for any suggestions

    PS D:\scripts> .\volume.ps1
    '+' "lost some kind of calculation process"
    "locate" D:\scripts\volume.ps1:5 "word":6
    +     +  <<<< CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    ----------------------------------------------------------------------------------

    Coding for volume.ps1

    The current volume control setting is:-1
    Exception calling "SetVolume" with "1" argument(s): "Cannot Set Volume"
    At D:\scripts\volume.ps1:433 char:44
    + [PC_VolumeControl.VolumeControl]::10000
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException


    Thanks in advance for any suggestions
    Monday, September 05, 2011 3:44 PM
  • I get following error when I run the coding.

    Does anyone have any suggestions?

    Thanks everyone very much for any suggestions

    PS D:\scripts> .\volume.ps1
    '+' "lost some kind of calculation process"
    "locate" D:\scripts\volume.ps1:5 "word":6
    +     +  <<<< CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    ----------------------------------------------------------------------------------

    Coding for volume.ps1

    The current volume control setting is:-1
    Exception calling "SetVolume" with "1" argument(s): "Cannot Set Volume"
    At D:\scripts\volume.ps1:433 char:44
    + [PC_VolumeControl.VolumeControl]::10000
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException


    Thanks in advance for any suggestions

    Can you post the contents of you script file?

    jv
    Monday, September 05, 2011 3:56 PM
  • The following code is the content of volume.ps1

    Does anyone have any suggestions?

    ----------------------------------------------------------------------------------

    The current volume control setting is:-1
    Exception calling "SetVolume" with "1" argument(s): "Cannot Set Volume"
    At D:\scripts\volume.ps1:433 char:44
    + [PC_VolumeControl.VolumeControl]::10000
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException


    Thanks in advance for any suggestions
    Monday, September 05, 2011 4:27 PM
  • The following code is the content of volume.ps1

    Does anyone have any suggestions?

    ----------------------------------------------------------------------------------

    The current volume control setting is:-1
    Exception calling "SetVolume" with "1" argument(s): "Cannot Set Volume"
    At D:\scripts\volume.ps1:433 char:44
    + [PC_VolumeControl.VolumeControl]::10000
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException


    Thanks in advance for any suggestions


    Does that look like code?

    Does PowerShell have an y code that look even close to that?

    Why can't you jsut download teh code I posted earlier.  That is what this yopic has been about.  I don't know where you got an exception dump from or how you managed to put it into a file.

    Please go back and download the code from the link above.  Numerous people have now loaded and tested it with success on XP.

     


    jv
    Monday, September 05, 2011 4:31 PM
  • Having fun, jv?  I've also got a 'live one', but we are getting there slowly, line by line.  At least my OP did use my code exactly :-)
    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"
    Monday, September 05, 2011 4:36 PM
  • Having fun, jv?  I've also got a 'live one', but we are getting there slowly, line by line.  At least my OP did use my code exactly :-)
    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"


    Same OP different topic.

    I get frustrated when I can't get teh OP to read teh instructions carefully.  No I realize it is not their fault as there is likely a language difference.  I also don't underestand why anyone would just pay no attention to the conmtents of an error.

    Someone in a blog noted that we should turn error mesages from red into something cooler so they wouldn't scre people so much. SO many users just panic when they see a red error message.  The error message is a friend. It tells us all kinds of things.

    Take this one:

    The current volume control setting is:-1
    Exception calling "SetVolume" with "1" argument(s): "Cannot Set Volume"
    At D:\scripts\volume.ps1:433 char:44
    + [PC_VolumeControl.VolumeControl]::10000
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException

    It say sthat one line executed and returned a -1.  Doesn't that look like the error message you posted?  How did that get in a PS1 file?

    Look at this:
    [PC_VolumeControl.VolumeControl]::10000

    That isn't a  method  anywhere.  Where dif it come from?

    The PS1 file lloks like this: http://www.designedsystemsonline.com/upload/set-pcvolume.ps1.txt

     

     


     


    jv
    Monday, September 05, 2011 5:21 PM
  • The PS1 file lloks like this: http://www.designedsystemsonline.com/upload/set-pcvolume.ps1.txt


    jv

    Once I download this file and save as set-pcvolume.ps1, could you please give me any suggestions on what to do next with this file? Does it require Powershell v2? I am currently using Powershell v1, may try v2 in this weekend.

    I receive following error, when I run it within powershell.

    Does anyone have any suggestions?

    ------------------------------------------------------------------------------------------------

    PS D:\scripts>  .\set-pcvolume.ps1
    'Add-Type' cannot be recognized as Cmdlet、variable, executable command, please check keyword, and try one more time.
    locate D:\scripts\set-pcvolume.ps1:430 word:9
    + Add-Type  <<<< $code
    cannot find [PC_VolumeControl.VolumeControl] type: please confirm whether install those components or not.
    locate D:\scripts\set-pcvolume.ps1:431 word:46
    + $VolumeLevel=[PC_VolumeControl.VolumeControl]: <<<< :GetVolume()
    The current volume control setting is:
    cannot find [PC_VolumeControl.VolumeControl] type: please confirm whether install those components or not.
    locate D:\scripts\set-pcvolume.ps1:433 word:33
    + [PC_VolumeControl.VolumeControl]: <<<< :SetVolume(0)
    cannot find [PC_VolumeControl.VolumeControl] type: please confirm whether install those components or not.
    locate D:\scripts\set-pcvolume.ps1:434 word:43
    + $NewLevel=[PC_VolumeControl.VolumeControl]: <<<< :GetVolume()
    The current volume control setting is:
    cannot find [PC_VolumeControl.VolumeControl] type: please confirm whether install those components or not.
    locate D:\scripts\set-pcvolume.ps1:436 word:33
    + [PC_VolumeControl.VolumeControl]: <<<< :SetVolume(65535)
    cannot find [PC_VolumeControl.VolumeControl] type: please confirm whether install those components or not.
    locate D:\scripts\set-pcvolume.ps1:437 word:43
    + $NewLevel=[PC_VolumeControl.VolumeControl]: <<<< :GetVolume()
    The current volume control setting is:
    cannot find [PC_VolumeControl.VolumeControl] type: please confirm whether install those components or not.
    locate D:\scripts\set-pcvolume.ps1:439 word:33
    + [PC_VolumeControl.VolumeControl]: <<<< :SetVolume($VolumeLevel)
    The current volume control setting is:

    ------------------------------------------------------------------------------------------------


    Thanks in advance for any suggestions
    Tuesday, September 06, 2011 3:49 AM
  • The PS1 file lloks like this: http://www.designedsystemsonline.com/upload/set-pcvolume.ps1.txt

     


    jv

     

    Once I download this file and save as set-pcvolume.ps1, could you please give me any suggestions on what to do next with this file? Does it require Powershell v2? I am currently using Powershell v1, may try v2 in this weekend.

    I receive following error, when I run it within powershell.

    Does anyone have any suggestions?

    ------------------------------------------------------------------------------------------------

    PS D:\scripts>  .\set-pcvolume.ps1
    'Add-Type' cannot be recognized as Cmdlet、variable, executable command, please check keyword, and try one more time.
    locate D:\scripts\set-pcvolume.ps1:430 word:9
    + Add-Type  <<<< $code
    cannot find [PC_VolumeControl.VolumeControl] type: please confirm whether install those components or not.
    locate D:\scripts\set-pcvolume.ps1:431 word:46
    + $VolumeLevel=[PC_VolumeControl.VolumeControl]: <<<< :GetVolume()
    The current volume control setting is:
    cannot find [PC_VolumeControl.VolumeControl] type: please confirm whether install those components or not.
    locate D:\scripts\set-pcvolume.ps1:433 word:33
    + [PC_VolumeControl.VolumeControl]: <<<< :SetVolume(0)
    cannot find [PC_VolumeControl.VolumeControl] type: please confirm whether install those components or not.
    locate D:\scripts\set-pcvolume.ps1:434 word:43
    + $NewLevel=[PC_VolumeControl.VolumeControl]: <<<< :GetVolume()
    The current volume control setting is:
    cannot find [PC_VolumeControl.VolumeControl] type: please confirm whether install those components or not.
    locate D:\scripts\set-pcvolume.ps1:436 word:33
    + [PC_VolumeControl.VolumeControl]: <<<< :SetVolume(65535)
    cannot find [PC_VolumeControl.VolumeControl] type: please confirm whether install those components or not.
    locate D:\scripts\set-pcvolume.ps1:437 word:43
    + $NewLevel=[PC_VolumeControl.VolumeControl]: <<<< :GetVolume()
    The current volume control setting is:
    cannot find [PC_VolumeControl.VolumeControl] type: please confirm whether install those components or not.
    locate D:\scripts\set-pcvolume.ps1:439 word:33
    + [PC_VolumeControl.VolumeControl]: <<<< :SetVolume($VolumeLevel)
    The current volume control setting is:

     


    Thanks in advance for any suggestions

    ------------------------------------------------------------------------------------------------


    Please look at the errors. 

    I have stated emphatically that this must run on PowerShell V2.

    All of the help you have gotten in this forum has required V2.  Please upgrade.

     


    jv
    Tuesday, September 06, 2011 10:44 AM
  • I need to test v2 on this weekend, once I am done and would like reply later.

    Thanks everyone very much for suggestions


    Thanks in advance for any suggestions
    Tuesday, September 06, 2011 3:01 PM
  • hi, 

    i'm also interested in a solution for win 7 64 bit, I would try it myself if tou don't want to go into it,

    i just need some guidance,

    Friday, September 09, 2011 9:18 AM
  • hi, 

    i'm also interested in a solution for win 7 64 bit, I would try it myself if tou don't want to go into it,

    i just need some guidance,


    You need to use the new Media SDK.

    Good luck.

     


    jv
    Friday, September 09, 2011 10:56 AM
  • The PS1 file lloks like this: http://www.designedsystemsonline.com/upload/set-pcvolume.ps1.txt

     


    jv

     

    Once I download this file and save as set-pcvolume.ps1, could you please give me any suggestions on what to do next with this file? Does it require Powershell v2? I am currently using Powershell v1, may try v2 in this weekend.

    I receive following error, when I run it within powershell.

    Does anyone have any suggestions?

    ------------------------------------------------------------------------------------------------

    PS D:\scripts>  .\set-pcvolume.ps1
    'Add-Type' cannot be recognized as Cmdlet、variable, executable command, please check keyword, and try one more time.
    locate D:\scripts\set-pcvolume.ps1:430 word:9
    + Add-Type  <<<< $code
    cannot find [PC_VolumeControl.VolumeControl] type: please confirm whether install those components or not.
    locate D:\scripts\set-pcvolume.ps1:431 word:46
    + $VolumeLevel=[PC_VolumeControl.VolumeControl]: <<<< :GetVolume()
    The current volume control setting is:
    cannot find [PC_VolumeControl.VolumeControl] type: please confirm whether install those components or not.
    locate D:\scripts\set-pcvolume.ps1:433 word:33
    + [PC_VolumeControl.VolumeControl]: <<<< :SetVolume(0)
    cannot find [PC_VolumeControl.VolumeControl] type: please confirm whether install those components or not.
    locate D:\scripts\set-pcvolume.ps1:434 word:43
    + $NewLevel=[PC_VolumeControl.VolumeControl]: <<<< :GetVolume()
    The current volume control setting is:
    cannot find [PC_VolumeControl.VolumeControl] type: please confirm whether install those components or not.
    locate D:\scripts\set-pcvolume.ps1:436 word:33
    + [PC_VolumeControl.VolumeControl]: <<<< :SetVolume(65535)
    cannot find [PC_VolumeControl.VolumeControl] type: please confirm whether install those components or not.
    locate D:\scripts\set-pcvolume.ps1:437 word:43
    + $NewLevel=[PC_VolumeControl.VolumeControl]: <<<< :GetVolume()
    The current volume control setting is:
    cannot find [PC_VolumeControl.VolumeControl] type: please confirm whether install those components or not.
    locate D:\scripts\set-pcvolume.ps1:439 word:33
    + [PC_VolumeControl.VolumeControl]: <<<< :SetVolume($VolumeLevel)
    The current volume control setting is:

     


    Thanks in advance for any suggestions

     

    ------------------------------------------------------------------------------------------------


    Please look at the errors. 

    I have stated emphatically that this must run on PowerShell V2.

    All of the help you have gotten in this forum has required V2.  Please upgrade.

     


    jv

    I have installed v2, it works now. :>


    Thanks in advance for any suggestions

    • Edited by oem7110 Saturday, September 10, 2011 3:03 PM
    Saturday, September 10, 2011 3:00 PM
  • Off-topic: jv, was that Primalforms you said?  It's not free.  I'm going to give it a trial.
    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"
    Saturday, September 10, 2011 3:02 PM
  • Off-topic: jv, was that Primalforms you said?  It's not free.  I'm going to give it a trial.
    [string](0..9|%{[char][int](32+("39826578840055658268").substring(($_*2),2))})-replace "\s{1}\b"


    Login and you can download the free community edition.  It isn't as full but it does let you design the forms with a GUI.

     


    jv
    Saturday, September 10, 2011 4:03 PM