wmic

Attempting to report CPU clock speed continuously in batch

…衆ロ難τιáo~ 提交于 2019-12-11 16:09:40
问题 I am trying to make a CPU clock speed tracker, but I need some help on the code. setlocal enableextensions enabledelayedexpansion :a for /f %%a in ('copy /Z "%~dpf0" nul') do set "ASCII_13=%%a" set /p "=!ASCII_13!" <NUL wmic cpu get CurrentClockSpeed goto a I'm interested in getting something like this: CurrentClockSpeed 2401 not this (the code I'm trying to use outputs this): CurrentClockSpeed 2401 CurrentClockSpeed 2401 CurrentClockSpeed 2401 CurrentClockSpeed 2401 Can you please help me?

AutoIT and quotes

一曲冷凌霜 提交于 2019-12-11 15:48:52
问题 I need to create AutoIT script which will call this: wmic path win32_tcpipprinterport where "hostaddress = 'server1'" set hostaddress="server2" tried to combine quotes like this: $CMD = 'wmic path win32_tcpipprinterport where ""hostaddress = ''server1''"" set hostaddress=""server2"" & pause' RunWait(@ComSpec & " /c " & $CMD) But still cannot make it working. Please can you help ? 回答1: But still cannot make it working. Example: $sCmd = 'wmic path win32_tcpipprinterport where "hostaddress = '

UUID to be stored in file

流过昼夜 提交于 2019-12-11 13:36:18
问题 I am trying to get the UUID of the system and to store it in a file. using the command wmic csproduct get UUID I am getting the output file as (UUID some spaces then value) i.e UUID 4C4C4544-0031-5910-8048-B1C04F565331 . But I need the value alone ( 4C4C4544-0031-5910-8048-B1C04F565331 ) in my output file. 回答1: filter the line, you need: wmic csproduct get uuid |find "-" >file.txt EDIT in reply to your comment: there is a more general way to get what you want: for /f %%i in ('wmic cpu get

How to get file version of a DLL or EXE to a variable using WMIC in a Windows batch file?

末鹿安然 提交于 2019-12-11 08:38:12
问题 I try to get the file version using a Windows batch file. This command successfully prints the version to console. WMIC DATAFILE WHERE name="Z:\\bin\\My_project.dll" get Version /format:Textvaluelist But when I try to get this output to a variable using the below method, Windows command processor outputs: Z:\\bin\\My_project.dll - Invalid alias verb. What is wrong on this command line? for /f %%a in ('WMIC DATAFILE WHERE name="Z:\\bin\\My_project.dll" get Version /format:Textvaluelist') do

WMIC MangementClass RemoteCommand - determining when it is finished? STDOUT?

那年仲夏 提交于 2019-12-11 06:17:56
问题 I'm executing a remote CMD line command via WMIC that takes a few seconds to run. I'm currently doing Thread.Sleep(4000) before moving on...there MUST be a better way! Is there a variable or method I can use to determine if the command I issued finished / a status byte? Thanks! Im using the following code to issue the commands: ManagementClass processTask = new ManagementClass(@"\\" + this.wmiConnection.machineName + @"\root\CIMV2", "Win32_Process", null); ManagementBaseObject methodParams =

How can I remove empty lines from wmic output?

谁说胖子不能爱 提交于 2019-12-09 11:00:47
问题 This is my string to obtain the position of TeamViewer (any version) service executable: for /f "skip=1 delims=" %A in ('wmic path win32_service where "name like 'TeamViewer%'" get pathname') do set POSITION=%A The problem is caused by wmic because it includes an empty line at the end of result (on Windows 7 command) and this is the output: C:\Users\giovanni>for /f "skip=1 delims=" %A in ('wmic path win32_service where "name like 'TeamViewer% '" get pathname') do set POSITION=%A :\Users

Batch: list available hard drives and work with chosen option

白昼怎懂夜的黑 提交于 2019-12-09 04:28:24
I would like to list all available, removable hard drives in a batch script and continue to work with the chosen option. I know there are options like wmic logicaldisk get caption,volumename to list the hard drives and SET /P M=Type 1 or 2 then press ENTER: IF %M%==1 GOTO One IF %M%==2 GOTO Two to create a menu. But how do I store the volumes in variables and list them in a menu? Something like: Choose from list: 1) D:\Harddrivename1 2) E:\Harddrivename2 Enter option: 2 Any help is appreciated! Here's a function that'll let you create an array of drives that are not of type 3 (fixed): rem //

Batch: list available hard drives and work with chosen option

坚强是说给别人听的谎言 提交于 2019-12-08 06:17:25
问题 I would like to list all available, removable hard drives in a batch script and continue to work with the chosen option. I know there are options like wmic logicaldisk get caption,volumename to list the hard drives and SET /P M=Type 1 or 2 then press ENTER: IF %M%==1 GOTO One IF %M%==2 GOTO Two to create a menu. But how do I store the volumes in variables and list them in a menu? Something like: Choose from list: 1) D:\Harddrivename1 2) E:\Harddrivename2 Enter option: 2 Any help is

Batch list usb drives, then copy content

╄→гoц情女王★ 提交于 2019-12-08 05:33:55
问题 I'm trying to make a batch file that list usb drive (it's usually one connected), then either cd in to the drive or copy the contents from the drive. I'm trying to to use wmic to list the drive, and I get the drive letter. But I have no idea how to execute the cd command using the information I got from wmic. wmic command: wmic volume where "drivetype=2" get driveletter /format:table | findstr : 回答1: Why not use Powershell to list the disks then filter for USB drives and go from there?

How to get File version in variable using .cmd

谁说我不能喝 提交于 2019-12-08 03:09:45
问题 I used wmic to get the version of a EXE stored in a variable. It works fine when I execute it from CMD (that I ran as Admin) but when executed either in a .cmd or .bat files (even when ran as admin) the variable is not populated. This works directly in CMD: set "npver="&for /F "tokens=2delims==" %a in ('wmic datafile where "Name='c:\\Windows\\System32\\notepad.exe'" get version /format:list') do set "npver=%a" When I created the .cmd file, I doubled the % signs. 回答1: You forgot to echo the