There could be a few reasons why wmic may work in Command Prompt (cmd) but not in a batch file:
Permission Issues: wmic may require administrative privileges to perform certain actions, and the batch file may not be running with sufficient permissions. Ensure that the batch file is being run as an administrator.
Syntax Error: There may be syntax errors in the batch file that are causing the wmic command to fail. Make sure that the syntax used in the batch file is correct.
Path Issues: The batch file may not be able to locate the wmic executable. Try adding the full path to the wmic executable in the batch file.
Environment Variables: The environment variables used by wmic may not be set correctly in the batch file. Check that the necessary environment variables are being set in the batch file.
Interference with Other Batch Commands: The wmic command may be interfering with other batch commands in the file. Try running the wmic command in a separate batch file to see if it works independently.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-07-01 16:43:10 +0000
Seen: 8 times
Last updated: Jul 01 '23
I keep receiving a 404 error while running the application on AWS EC2, can you help me with that?
How do I resolve a 502 error when attempting to call an HTTPS REST API from an HTTP REST API?
In a Bootstrap 5.1 Modal popup, why is the property 'classList' unable to be read for undefined?
How can the issue of an image not being shown in ASP.NET MVC be resolved?
Although values are present in GTM, why are some DataLayer parameter values absent in GA4?
What does the error message "Incorrect syntax near ')'" mean in SQL?