4 ms·
powershell is still built on crap I had it randomly throwing exceptions the other day that a path was too long (it was only about 300 characters...)
by blibble 4y ago
powershell is still built on crap
I had it randomly throwing exceptions the other day that a path was too long
(it was only about 300 characters...)
- mdaniel 4y agoThe irony of commenting that under an article that cites the maximum path cannot exceed 260 characters is not lost on me
- blibble 4y agohow is that ironic?
- inferiorhuman 4y agoIt's like rain on your wedding day
- noAnswer 4y agoBut the path length can be longer! They just don't care and offload the work.
- mauvehaus 4y agoThe maximum path length of the NT kernel is 3276-something UCS-2 characters. 260 is a limit imposed by the legacy Win32 interfaces IIRC. I believe the W-interfaces get you the full-fat version, it's just that they're so inconsistently used as to all but guarantee that something you need will have problems. The user-mode stuff is kind of a mess. The kernel-mode stuff is comparatively orthogonal.
- magicalhippo 4y agoYou also have to prefix[1] the path with \\?\ unless you've enabled a group policy[2] in Windows 10+. [1]: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea#parameters https://learn.microsoft.com/en-us/windows/win32/api/fileapi/... [2]: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation https://learn.microsoft.com/en-us/windows/win32/fileio/namin...
- dingdingdang 4y agoIt also adds it's own special brand of crap .. as in after trying 10x different ways (not kidding: https://social.technet.microsoft.com/wiki/contents/articles/7703.powershell-running-executables.aspx#Additional_Resources https://social.technet.microsoft.com/wiki/contents/articles/...) of executing an external ffmpeg command over several hrs I eventually wrote a one line .bat file* and was done with it. Never again. * for %%a in ("*.mp4") do ffmpeg -i "%%a" -vcodec libx265 -crf 26 -tune animation "%%~na.mkv"
- Kwpolska 4y agoIt's very simple, you don't need any special magic to run a command. gci -filter "*.mp4" | foreach { ffmpeg -i $_ -vcodec libx265 -crf 26 -tune animation ($_ -replace '.mp4','.mkv') } Files with spaces just work.