Announcement

Collapse
No announcement yet.

Quick bit of help required please!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Quick bit of help required please!

    Can somebody tell me why the below code wont work?
    I am running as administrator by the way.
    Code:
    File.Run("C:\\windows\\system32\\wbem\\WMIC.exe", "wmic NIC where NetEnabled=true get Name, Speed >C:\\netspeed.txt", "C:\\windows\\system32\\wbem\\", SW_MINIMIZE, true);

  • #2
    Have you read the help file? You could try the following things:
    • Use Application.GetLastError immediately after you attempt the above code
    • Store the return from File.Run and then print it and see what you get.
    • Try removing the command line arguments
    • Check you are pointing to the correct file location

    When asking for help, try to supply as much information as possible (EG "The application freezes and then crashes" or "It runs past the code but doesn't execute" instead of "it doesn't work" as a starter). A lot of more experienced users don't feel like helping people that they perceive as not having put any effort in.

    Comment


    • #3
      Yes I have read the help file, multiple times, also searched the forums here hence why I am posting.
      Error checking dont give me any errors, and I even mapped everything out ie: sloc = _TempFolder:\\net.txt" and sargs = wmic NIC where NetEnabled=true get Name, Speed, put the variables into a dialog.message and it shows the full command how it should be, but no file gets created.

      I tried a different way around that works, as in AMS will call the cmd file and the text file does get created, but I need to load a certain line of the text file to a string, the whole text file is below:
      Code:
      Name                                Speed       
      Realtek PCIe GBE Family Controller  1000000000

      Comment


      • #4
        Don't know what you are trying, but the commandline with the parameter
        "wmic NIC where NetEnabled=true get Name, Speed >C:\\netspeed.txt"
        could not work.

        If the commandline has a content that needs " you have to Escape it correctly. Maybe a parameter like
        "wmic NIC where NetEnabled=true get Name, Speed >C:\\netspeed.txt"
        needs to be transformed to something like
        "wmic NIC where NetEnabled=\"true\" get Name, Speed >\"C:\\netspeed.txt\""

        I just take a short look at the Page at https://msdn.microsoft.com/en-us/lib...2610.aspx#ECAA , i never used WMIC.
        Please pay atention at the format of the commandline.

        Comment

        Working...
        X