1

I'm using nssm.exe in my scripts to manage the windows services. But in PowerShell, the command output is coming with spaces after every alphabet.

PS> $nssm = (Get-Command D:\nssm.exe)
PS> & $nssm
nssm.exe : N S S M :   T h e   n o n - s u c k i n g   s e r v i c e   m a n a g e r 
At line:1 char:1
+ & $nssm
+ ~~~~~~~
    + CategoryInfo          : NotSpecified: (N S S M :   T h... m a n a g e r :String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
 
 
 V e r s i o n   2 . 2 4   3 2 - b i t ,   2 0 1 4 - 0 8 - 3 1 
 
 
 U s a g e :   n s s m   < o p t i o n >   [ < a r g s >   . . . ] 
 
 
 
 
 
 T o   s h o w   s e r v i c e   i n s t a l l a t i o n   G U I : 
 
 
 
 
 
                 n s s m   i n s t a l l   [ < s e r v i c e n a m e > ] 
 
 
 
 
 
 T o   i n s t a l l   a   s e r v i c e   w i t h o u t   c o n f i r m a t i o n : 
 
 
 
 
 
                 n s s m   i n s t a l l   < s e r v i c e n a m e >   < a p p >   [ < a r g s >   . . . ] 
 
 
 
 
 
 T o   s h o w   s e r v i c e   e d i t i n g   G U I : 
 
 
 
 
 
                 n s s m   e d i t   < s e r v i c e n a m e > 

How to get the output without such wide-format spaces among alphabets?

oguz ismail
  • 1
  • 16
  • 47
  • 69
Farrukh Waheed
  • 2,163
  • 2
  • 29
  • 59
  • I cannot recreate your issue. I have Win10, both PowerShell 7.2.1 and 5.1, both 32bt and 64bit nsmm.exe. Your issue is clearly Unicode being converted to ASCII, but I don't get why that is happening for you. – Darin Apr 20 '22 at 12:20
  • 2
    If you look for unicode on this page (https://nssm.cc/usage), it is clear that nssm guesses if the output should be unicode or ansi (Ansi is ASCII with special codes). With that in mind, maybe saving output to a file and then sending the file to the host will work reliably. – Darin Apr 20 '22 at 12:30
  • It's not spaces, but nulls from utf16 output. Sfc does the same thing. – js2010 Apr 20 '22 at 14:08

0 Answers0