wmic

WMIC: how to use **process call create** with a specific working directory?

*爱你&永不变心* 提交于 2020-01-01 05:27:08
问题 The task is to launch a program using wmic process call create "c:\folder\app.exe" and have app.exe access it's own support files in the app.exe home folder tree . The batch script below illustrates the problem with WMIC silently changing the working directory, so that the support files cannot be found. This script creates a second batch file called one.bat that simply types a url.txt file from the same folder, to display www.google.com on the console. When using wmic to create the process,

WMIC.bat file will not export/output properly

蹲街弑〆低调 提交于 2019-12-31 04:11:55
问题 I am attempting to run a batch file in CMD that includes the following, wmic csproduct wmic cpu get name wmic diskdrive get model,size ipconfig /all When I copy and paste this into CMD, I am able to watch the commands run. I am successfully able to copy and paste all of the data into a text document without issue. The Issue: When I attempt to export/output this exact file into a .txt or .rtf, C:> 1.bat > 1.txt "ipconfig" pulls properly, yet the WMIC commands do not does not give me any issues

Using wmic to get drives space information

老子叫甜甜 提交于 2019-12-29 09:37:07
问题 I'm trying to get info of the physical drives in a computer with wmic to get something like this: Drive C: 500 GB Total 100 GB Free 20% Free Drive D: 500 GB Total 100 GB Free 20% Free My code so far is: for /f "usebackq tokens=*" %%a in (`wmic logicaldisk where "drivetype=3" get caption`) do ( echo "Drive=%%a" for /f "usebackq delims== tokens=2" %%x in (`wmic logicaldisk where DeviceID='%%a'" get FreeSpace /format:value`) do set FreeSpace=%%x for /f "usebackq delims== tokens=2" %%x in (`wmic

Windows Forms - How to return WMIC output into Textbox

僤鯓⒐⒋嵵緔 提交于 2019-12-25 14:22:37
问题 I'm new to coding ( 3 days in and learning primarily from Google ) it's going well enough so far but now I'm stuck :) I want to run a WMIC command and return the second line of the output into a textbox. The WMIC command is: 'WMIC bios get serialnumber' This returns: SerialNumber ABCD1234 How do I get just the serial number into a textbox please? Thanks... 回答1: Add reference to System.Management and use the following in your form method. ManagementObjectSearcher searcher = new

Executing a batch file containing an exe path remotely via wmic

十年热恋 提交于 2019-12-25 09:37:40
问题 I have a batch file on Computer-A that contains several commands and a path to an exe file. When I execute the batch file on Computer-B via wmic, I can see all the commands being executed in the batch file except that it does not run the exe. What are the things I need to check for to see why the .exe is not being executed on Computer-A? wmic execution: wmic /node:"<server_ip>" /user:domain\user /PASSWORD:"password" /OUTPUT:STDOUT process call create "cmd.exe /c C:\Folder\batch.bat" 回答1: File

Issues automating printer driver update (printer settings) and printer preferences in Win7, using a PS,cmd,vbs,etc script?

你说的曾经没有我的故事 提交于 2019-12-25 05:34:15
问题 WMI can do it, but I have an issue, PCs are on, but logged off. If I try to run: wmic /node:%strIP% printer where DeviceID="lp1" set DriverName="Lexmark Universal v2" It fails with a message about a "generic failure". I RDP in and then run the same command from my end, and it works. Powershell version I am using is older, so it does not have some of the printer cmdlets, and updating PS is currently out of the question. Is there a way to remotely log someone in, without actually having to RDP

Querying process by CommandLine

耗尽温柔 提交于 2019-12-25 03:07:15
问题 I'm trying to do the following query in WMI: SELECT ProcessID from Win32_Process where CommandLine='C:\Windows\system32\calc.exe' But I got an "Invalid query" error. I also tried with: SELECT ProcessID from Win32_Process where CommandLine='C:\\Windows\\system32\\calc.exe' And still get the same error, also I tried to change the single quotes to double quotes but it didn't work. Does anybody know if its possible to do that query? 回答1: Yes and No. Depends on how calc.exe is spawned. For

Querying process by CommandLine

左心房为你撑大大i 提交于 2019-12-25 03:07:00
问题 I'm trying to do the following query in WMI: SELECT ProcessID from Win32_Process where CommandLine='C:\Windows\system32\calc.exe' But I got an "Invalid query" error. I also tried with: SELECT ProcessID from Win32_Process where CommandLine='C:\\Windows\\system32\\calc.exe' And still get the same error, also I tried to change the single quotes to double quotes but it didn't work. Does anybody know if its possible to do that query? 回答1: Yes and No. Depends on how calc.exe is spawned. For

Getting the arguments passed to a executable using wmic

孤街浪徒 提交于 2019-12-24 17:24:32
问题 I am trying to get commandline arguments of an executable which was launched by another program. I tried the command mentioned in this answer, but I can't understand the syntax :( I am trying to get the commandline arguments of an process, I have the PID & the process name, In this case I am trying get arguments of an ping command which I am using to test the command... Thanks in Advance :) 回答1: Try this: wmic process where "name='ping.exe'" get commandline /format:list Or if you prefer to

wmic /failfast does nothing

邮差的信 提交于 2019-12-24 15:05:09
问题 for /f "tokens=*" %%a in (ip.txt) do ( wmic /FAILFAST:ON /node:%%a /user: /password: computersystem get Name, domain, Manufacturer, Model, NumberofProcessors, PrimaryOwnerName,Username, Roles, totalphysicalmemory /format:list wmic /FAILFAST:ON /node:%%a /user: /password: cpu get Name, Caption, MaxClockSpeed, DeviceID, status /format:list wmic /FAILFAST:ON /node:%%a /user: /password: path Win32_VideoController get Name, status, DeviceID /format:list wmic /FAILFAST:ON /node:%%a /user: /password