Advanced system utilities to manage, troubleshoot, and diagnose Windows and Linux systems and applications.
Is it the path to the executable or the length of the command line arguments?
It works for me on Win11, PS 5.1, Autoruns v13.91, 4000 characters.
I had to add extra quotes to the binpathname.
sc.exe delete ZZLongPathTest
$long = 'x' * 4000
New-Service -Name 'ZZLongPathTest' -BinaryPathName """C:\Windows\System32\notepad.exe"" $long" -StartupType Automatic
autorunsc64.exe | sls autoruns
autorunsc64.exe -accepteula -nobanner -a s -ct | sls ZZLongPathTest
I tried to add a screen snip like I normally do, but it reports "failed". Maybe a hangover all the problems MS had yesterday.
PS C:\temp> sc.exe delete ZZLongPathTest
[SC] DeleteService SUCCESS
PS C:\temp> $long = 'x' * 4000
PS C:\temp> New-Service -Name 'ZZLongPathTest' -BinaryPathName """C:\Windows\System32\notepad.exe"" $long" -StartupType Automatic
Status Name DisplayName
------ ---- -----------
Stopped ZZLongPathTest ZZLongPathTest
PS C:\temp> autorunsc64.exe | sls autoruns
Sysinternals Autoruns v13.91 - Autostart program viewer
PS C:\temp> autorunsc64.exe -accepteula -nobanner -a s -ct | sls ZZLongPathTest
9/16/2018 12:58 AM HKLM\System\CurrentControlSet\Services ZZLongPathTest enabled Services System-wide ZZLongPathTest: Notepad Microsoft Corporation
c:\windows\system32\notepad.exe 10.0.26100.9818 ""C:\Windows\System32\notepad.exe"" xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx