No CMD output

Forums Desktop Info No CMD output

Tagged: , , ,

Viewing 25 reply threads
  • Author
    Posts
    • #3878
      Nathan_K
      Participant

      I’m having an issue lately where my CMD line isn’t resulting in any output. I just get “<n/a>” returned due to no result.

      CMD=active:1,interval:5,read-as-csv:1,csv-header:0,file:nvidia-smi.exe,parameters:--query-gpu=utilization.gpu\,temperature.gpu\,memory.used\,memory.total --format=csv\,noheader\,nounits,trim:1,show-window:0,color:22ccee,chart:line2 scale:linear max:100 series1:%1 color1:00ff00,threshold1:1 40 909090,threshold2:1 60 FFBF00,threshold3:1 90 ff0000,text:GPU Usage,display:Usage: %1% Temp: %2C %chart%|Memory: %3 MiB / %4 MiB

      Debug logs show the following:

      09-04-21 11:01:10:038 DATA  CMD --query-gpu=utilization.gpu,temperature.gpu,memory.used,memory.total --format=csv,noheader,nounits
      09-04-21 11:01:10:041 DEBUG CMD run, time: 0ms
      09-04-21 11:01:10:042 DEBUG CMD process
      09-04-21 11:01:10:043 DATA  CMD () True

      If I run the command from CMD.EXE directly I get the following:

      C:\>nvidia-smi.exe --query-gpu=utilization.gpu,temperature.gpu,memory.used,memory.total --format=csv,noheader,nounits
      2, 44, 1873, 4096

      Version: 2.10.2 (was in issue in 2.10.1 as well)

      Thanks in advance.

    • #3879
      Glenn
      Keymaster

      weird. almost like it can’t find nvidia-smi.exe.

    • #3880
      Nathan_K
      Participant

      Agreed. I’ve tried it using “CMD.EXE” and “/C nvidia-smi.exe ……” for the parameters as well. I get the same result. Are you able to replicate the issue at all?

      This snippet works fine though and I get the expected output. Perhaps something in the CSV output?

      CMD=active:1,interval:3,file:cmd.exe,parameters:/C hostname,trim:1,text:Test CMD,display:%4

    • #3881
      Nathan_K
      Participant

      So I just tested my CSV theory with the following snippet, which, if I’m reading your manual correctly, should output the exact thing as the prior snippet (previous reply).

      CMD=active:1,interval:3,read-as-csv:1,csv-header:0,file:cmd.exe,parameters:/C hostname,trim:1,text:Test CMD,display:%1

      Instead, I get the output of “<n/a>”.

    • #3882
      Glenn
      Keymaster

      The trim option might be messing up the csv parser. Try setting it to 0.

    • #3883
      Nathan_K
      Participant

      Tried with Trim set to 0. Same result.

    • #3884
      Nathan_K
      Participant

      Allow me to clarify on that. Same result of “<n/a>” for the nvidia-smi.exe line, but it does fix the display issue when used with the hostname test I performed.

    • #3885
      Nathan_K
      Participant

      So I tried changing my nvidia-smi.exe line to use cmd.exe with “/C nvidia-smi.exe” instead and the command causes DTI to hang while trying to display the output. Almost like the command isn’t finishing it’s execution.

    • #3886
      Glenn
      Keymaster

      I’m hamstrung because I don’t have a box with an nvidia card to test on.

      Try running nvidia-smi.exe with no parameters so that it returns it’s standard error message.

      CMD=interval:5,file:”C:\Program Files\Nvidia Corporation\NVSMI\nvidia-smi.exe”

      Try adding the full path as above.

      I notice nvidia-smi wants to be run as Administrator.

    • #3887
      Nathan_K
      Participant

      Since NVIDIA also installs the .exe into the Windows\System32 path, you can run it without a path on it. Below are the commands I executed, and their output. Also, it does not require Administrator level permissions to be executed.

      CMD=interval:5,file:nvidia-smi.exe

      Output: Command <n/a>

      From a CMD.EXE prompt:

      C:\>nvidia-smi.exe
      Tue Apr 13 21:47:23 2021
      +-----------------------------------------------------------------------------+
      | NVIDIA-SMI 461.40       Driver Version: 461.40       CUDA Version: 11.2     |
      |-------------------------------+----------------------+----------------------+
      | GPU  Name            TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC |
      | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
      |                               |                      |               MIG M. |
      |===============================+======================+======================|
      |   0  GeForce GTX 105... WDDM  | 00000000:01:00.0  On |                  N/A |
      |  0%   49C    P8    N/A /  72W |    807MiB /  4096MiB |      2%      Default |
      |                               |                      |                  N/A |
      +-------------------------------+----------------------+----------------------+
      
      +-----------------------------------------------------------------------------+
      | Processes:                                                                  |
      |  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
      |        ID   ID                                                   Usage      |
      |=============================================================================|
      |    0   N/A  N/A      1568    C+G   ...zilla Firefox\firefox.exe    N/A      |
      |    0   N/A  N/A      1676    C+G   Insufficient Permissions        N/A      |
      |    0   N/A  N/A      2040    C+G   ...zilla Firefox\firefox.exe    N/A      |
      |    0   N/A  N/A      5260    C+G   ...root\Office16\OUTLOOK.EXE    N/A      |
      |    0   N/A  N/A      7480    C+G   C:\Windows\explorer.exe         N/A      |
      |    0   N/A  N/A     10184    C+G   Insufficient Permissions        N/A      |
      |    0   N/A  N/A     11268    C+G   ...Battle.net\Battle.net.exe    N/A      |
      |    0   N/A  N/A     13036    C+G   ...s (x86)\Origin\Origin.exe    N/A      |
      |    0   N/A  N/A     13064    C+G   Insufficient Permissions        N/A      |
      |    0   N/A  N/A     13644    C+G   ...5n1h2txyewy\SearchApp.exe    N/A      |
      |    0   N/A  N/A     14228    C+G   ...y\ShellExperienceHost.exe    N/A      |
      |    0   N/A  N/A     14324    C+G   ...ekyb3d8bbwe\YourPhone.exe    N/A      |
      |    0   N/A  N/A     14828    C+G   ...Battle.net\Battle.net.exe    N/A      |
      |    0   N/A  N/A     14928    C+G   ...nputApp\TextInputHost.exe    N/A      |
      |    0   N/A  N/A     15492    C+G   ...d\app-0.0.309\Discord.exe    N/A      |
      |    0   N/A  N/A     15736    C+G   ...ram Files\LGHUB\lghub.exe    N/A      |
      |    0   N/A  N/A     16704    C+G   ...les\reWASD\reWASDTray.exe    N/A      |
      |    0   N/A  N/A     16892    C+G   ...86)\Overwolf\Overwolf.exe    N/A      |
      |    0   N/A  N/A     18012    C+G   ...qxf38zg5c\Skype\Skype.exe    N/A      |
      |    0   N/A  N/A     18100    C+G   ...ropbox\Client\Dropbox.exe    N/A      |
      |    0   N/A  N/A     18808    C+G   ...qxf38zg5c\Skype\Skype.exe    N/A      |
      |    0   N/A  N/A     19376    C+G   ....0.12\OverwolfBrowser.exe    N/A      |
      |    0   N/A  N/A     20888    C+G   ...lPanel\SystemSettings.exe    N/A      |
      +-----------------------------------------------------------------------------+
    • #3888
      Glenn
      Keymaster

      if you were to redirect that output to a text file from the command line:

      C:\>nvidia-smi.exe >nvidia.txt

      and open it in notepad.exe what would the text encoding be?

      is 461.40 the version of the executable?

    • #3889
      Nathan_K
      Participant

      The txt file is formatted UTF-16LE.

      As far as the version, 461.40 is the current driver version, but NVIDIA updates the nvidia-smi.exe with each driver update. The file version is 8.17.14.6140, of which you will not the last 5-digits of the file version match the driver version.

    • #3890
      Glenn
      Keymaster

      try adding code page to the DTI options:

      CMD=interval:5,file:nvidia-smi.exe,code-page:437

    • #3891
      Nathan_K
      Participant

      Didn’t seem to help. I did some additional testing and this part makes no sense what so ever.

      CMD=active:1,interval:3,read-as-csv:0,csv-header:0,file:cmd.exe,parameters:/C "C:\Windows\System32\nvidia-smi.exe",trim:1,code-page:437,text:Test CMD,display:%4'
      
      Results in the following:
      

      ‘C:\Windows\System32\nvidia-smi.exe’ is not recognized as an internal or external command,
      operable program or batch file.`

      But, running the same from the CMD prompt (non-elevated) results with:

      Wed Apr 14 20:51:42 2021
      +-----------------------------------------------------------------------------+
      | NVIDIA-SMI 461.40       Driver Version: 461.40       CUDA Version: 11.2     |
      |-------------------------------+----------------------+----------------------+
      | GPU  Name            TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC |
      | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
      |                               |                      |               MIG M. |
      |===============================+======================+======================|
      |   0  GeForce GTX 105... WDDM  | 00000000:01:00.0  On |                  N/A |
      |  0%   54C    P8    N/A /  72W |   1534MiB /  4096MiB |     35%      Default |
      |                               |                      |                  N/A |
      +-------------------------------+----------------------+----------------------+
      ........
    • #3892
      Glenn
      Keymaster

      directory option?

      maybe run it via a batch file? I’m clutching at straws now trying to think of ways to understand what’s going on.

    • #3893
      Nathan_K
      Participant

      Ok, so I created a batch file to test this as you recommended.

      Batch file:

      @Echo Off
      If Exist "C:\WINDOWS\SYSTEM32\NVIDIA-SMI.EXE" Goto STATUS
      
      :: Exit with error code
      Echo Unable to locate executable.
      Exit
      
      :STATUS
      C:\WINDOWS\SYSTEM32\NVIDIA-SMI.EXE --query-gpu=utilization.gpu,temperature.gpu,memory.used,memory.total --format=csv,noheader,nounits
      Exit

      Output when run from CMD directly:

      C:\Users\nxxxxxxxxxxx\AppData\Local\DesktopInfo\scripts>gpu-status.bat
      4, 58, 1569, 4096

      Config line:
      CMD=active:1,interval:3,read-as-csv:0,csv-header:0,file:cmd.exe,parameters:/C .\scripts\gpu-status.bat,trim:1,text:Test CMD,display:%4

      Output from DTI:
      Unable to locate executable.

      I’m at a complete loss.

    • #3895
      Glenn
      Keymaster

      so that tells me that DTI is running the batch file successfully but the process that is running the batch file doesn’t have access to c:\windows\system32.

      a couple of things to try:

      1. replace nvidia-smi.exe with some other command line tool in system32, say diskperf.exe, driverquery.exe etc. anything that produces a command line output.

      2. when running nvidia-smi.exe directly from the DTI CMD item, I would be interested to see the error codes:

      CMD=file:c:\windows\system32\nvidia-smi.exe, display:%1 %2 %3 %4

      • This reply was modified 3 months, 1 week ago by Glenn.
    • #3897
      Nathan_K
      Participant

      Output when run using your snippet above are as follows: 0 2 0

      As for putting DISKPERF.EXE into the batch file instead? The output is below:

      Both Logical and Physical Disk Performance counters on this system
              are automatically enabled on demand.
      For legacy applications using IOCTL_DISK_PERFORMANCE to retrieve raw counters,
      you can use -Y or -N to forcibly enable or disable. No restart is required.

      Works perfect. This is making less and less sense as we go along.

    • #3898
      Nathan_K
      Participant

      So I’ve got it working, thought it isn’t pretty. While I couldn’t get it to find or read the file in the C:\Windows\System32 path, I managed to get it to read the one in the DriverStore sub-folder. But since that folder name can change, I had to jump through some ugly hoops to get it to work right. My line of config code is below.

      CMD=active:1,interval:5,hide-no-result:1,read-as-csv:1,csv-header:0,file:powershell.exe,parameters:-Command "& $($(Get-ChildItem -Path 'C:\Windows\System32\DriverStore' -Include nvidia-smi.exe -Recurse -File).FullName) --query-gpu=utilization.gpu\,temperature.gpu\,memory.used\,memory.total --format=csv\,noheader\,nounits",trim:0,show-window:0,color:22ccee,chart:line2 scale:linear max:100 series1:%1 color1:00ff00,threshold1:1 40 909090,threshold2:1 60 FFBF00,threshold3:1 90 ff0000,text:GPU Usage,display:Usage: %1% Temp: %2C %chart%|Memory: %3 MiB / %4 MiB

      I’m getting the output I’m looking for and it’s working fine, but that was not fun.

      Attachments:
    • #3902
      Glenn
      Keymaster

      wow! nice work.

      according to the manual the error codes are:

      0 = CreateProcess failed.
      2 = Error Code 2 = ERROR_FILE_NOT_FOUND

      I don’t know exactly what that means in this case but for some reason the system is blocking you from accessing that exe file in the system32 directory.

      • This reply was modified 3 months ago by Glenn.
    • #3917
      JoeJr
      Participant

      Hi!
      Desktop Info is a wonderful tool, but I have the same problem as the OP.
      So, I did some testing, and there is a couple of strange things happening.

      1. DesktopInfo.exe never tries to read C:\Windows\System32 when looking for the EXE-file.
      You can test this by pointing directly to the file (C:\Windows\System32\nvidia-smi.exe) and use a tool, f.ex Process Monitor by Sysinternals to verify this.

      2. The parameters option does not work in this context.
      Using the option just triggers the default screen in nvidia-smi.

      I copied the file to another directory, and renamed it to be sure, n-smi.exe.

      This now works as expected:
      CMD=text:GPUtest,interval:5,read-as-csv:1,csv-header:0,file:F:\Test\n-smi.exe --query-gpu=utilization.gpu\,temperature.gpu\,memory.used\,memory.total\,power.draw --format=csv\,noheader\,nounits,display:Usage: %1% Temp: %2C |Memory: %3 MiB / %4 MiB|PowerUse: %5 W,chart:line2 scale:linear max:100 series1:%2 color1:%Green%,threshold1:1 40 909090,threshold2:1 60 FFBF00,threshold3:1 90 ff0000

      I also copied the renamed file back to System32, and the same thing happens. DesktopInfo.exe never reads that directory

      Kind Regards,
      JoeJr

    • #3920
      Glenn
      Keymaster

      I bet it’s getting redirected to C:\Windows\SysWOW64

    • #3923
      JoeJr
      Participant

      Good Sir! You are absolutely correct! 🙂

      Kind Regards,
      JoeJr

      Attachments:
    • #3927
      JoeJr
      Participant

      But, it works when copying the exe file, and version upgrades are easily checked with a script.
      So I’m a happy camper.

      Kind Regards,
      JoeJr

      Attachments:
    • #3952
      Glenn
      Keymaster

      Instead of adding a wow option like the REG item, I’ve wrapped the CreateProcess call in Wow64DisableWow64FsRedirection / Wow64RevertWow64FsRedirection calls. This means it will go where it’s told. I’ve done the same for the CONTROL items so things like printmanagement.msc will work properly.

    • #3955
      Nathan_K
      Participant

      Instead of adding a wow option like the REG item, I’ve wrapped the CreateProcess call in Wow64DisableWow64FsRedirection / Wow64RevertWow64FsRedirection calls. This means it will go where it’s told. I’ve done the same for the CONTROL items so things like printmanagement.msc will work properly.

      So we should expect to see v2.10.3 with this change?

      • #3956
        Glenn
        Keymaster

        v2.11 coming soon …

Viewing 25 reply threads
  • You must be logged in to reply to this topic.
Glenn's Page