윈 도 우 볼륨,소리 조절 nircmd.exe 이용 (vbscript) -- 수정된 첨부파일로 교체--
2020.01.20 02:00
brightness40.vbs (nircmd.exe 이용)
스크립트 시작
Const OverwriteExisting = True
Const strComputer = "."
Dim Fso, objShell, WshShell, objWMIService, colProcessList
'--------------
If WScript.Arguments.length =0 Then
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "wscript.exe", Chr(34) & _
WScript.ScriptFullName & Chr(34) & " uac", "", "runas", 1
Else
'--------------
Set WshShell = CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'Vb.exe'")
OSArchCheck = WshShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE")
'--------------
For Each objProcess in colProcessList
objProcess.Terminate()
Next
'--------------
WshShell.Run "nircmd setbrightness 40"
'--------------
End If
스크립트 끝
nircmd.vbs(windows폴더에 복사)
스크립트 시작
Const OverwriteExisting = True
Const strComputer = "."
Dim Fso, objShell, WshShell
'--------------
If WScript.Arguments.length =0 Then
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "wscript.exe", Chr(34) & _
WScript.ScriptFullName & Chr(34) & " uac", "", "runas", 1
Else
'--------------
Set WshShell = CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
OSArchCheck = WshShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE")
curDir = FSO.GetParentFolderName(WScript.ScriptFullName)
'--------------
If not FSO.FileExists("C:\Windows\nircmd.exe") Then
If OSArchCheck = "x64" Then
FSO.CopyFile curDir & "\nircmd64.exe", "C:\Windows\nircmd.exe", OverwriteExisting
Else
FSO.CopyFile curDir & "\nircmd86.exe", "C:\Windows\nircmd.exe", OverwriteExisting
End If
Else
End If
'--------------
Nir = "C:\Windows\nircmd.exe"
WshShell.Run Chr(34) & Nir & Chr(34)
WshShell.Run "nircmd sendkey enter press"
'--------------
End If
스크립트 끝
댓글 [7]
-
cungice 2020.01.20 08:18
-
왕초보 2020.01.20 09:22
멋진 작품 감사합니다...
오늘 하루도 웃음이 가득힌 일만 있으시길 바랍니다..
-
그냥그렇다 2020.01.20 09:29
감사합니다.
-
한돼지 2020.01.20 14:09
감사합니다
파일을 찿을수 없습니다
밝기 맟 소리 각각
런타임에러발생합니다.
확인부탁드림니다
-
드림캐쳐 2020.01.20 14:26
1. vb 폴더안의 nircmdx64.exe 와 nircmdx86.exe를 vb.exe가 위치한 상위폴더로 이동합니다.
또는, 그대로 두고,
2. vb폴더안의 vbs파일 을 메모장을 열어 다음위치의 코드를변경합니다.
FSO.CopyFile ".\nircmd64.exe", "C:\Windows\nircmd.exe", OverwriteExisting
Else
FSO.CopyFile ".\vb\nircmd86.exe", "C:\Windows\nircmd.exe", OverwriteExisting
을 다음과 같이,
FSO.CopyFile ".\vb\nircmd64.exe", "C:\Windows\nircmd.exe", OverwriteExisting
Else
FSO.CopyFile ".\vb\nircmd86.exe", "C:\Windows\nircmd.exe", OverwriteExisting
-
레마클로 2020.01.20 16:34 curdir 를 넣어서 수정했고
FSO.CopyFile curdir & "\nircmd64.exe", "C:\Windows\nircmd.exe", OverwriteExisting
아예 nircmd 복사 탭을 만들었습니다.^^
-
한돼지 2020.01.20 18:46
감사합니다
소리 단계별 작동 잘됨니다.
그런데 위와 같은 에러메세지 나오지만 . . .
화면 밝기는 체감 할 수 없어요 . . .
수고 하셨습니다. 감사합니다.