powershell-v5.1

Iterate a backed up ascii text file, find all instances of {LINE2 1-9999} replace with {LINE2 “line number the code is on”}. Overwrite. Faster?

怎甘沉沦 提交于 2019-12-01 12:40:19
This code works. I just want to see how much faster someone can make it work. Backup your Windows 10 batch file in case something goes wrong. Find all instances of string {LINE2 1-9999} and replace with {LINE2 "line number the code is on"}. Overwrite, encoding as ASCII. If _61.bat is: TITLE %TIME% NO "%zmyapps1%\*.*" ARCHIVE ATTRIBUTE LINE2 1243 TITLE %TIME% DOC/SET YQJ8 LINE2 1887 SET ztitle=%TIME%: WINFOLD LINE2 2557 TITLE %TIME% _*.* IN WINFOLD LINE2 2597 TITLE %TIME% %%ZDATE1%% YQJ25 LINE2 3672 TITLE %TIME% FINISHED. PRESS ANY KEY TO SHUTDOWN ... LINE2 4922 Results: TITLE %TIME% NO "

What type of object is $<drivename>: (such as `$code:`) in Powershell?

六眼飞鱼酱① 提交于 2019-12-01 11:14:46
I was using tab autocompletion for a variable name in Powershell 5.1 today and noticed that one of the choices was the name of a PSDrive. The drive name is docs and I wanted to expand is called $document_name . When I typed $do<tab> , the shell did indeed expand what I had typed to $document_name but for some reason, I typed <tab> a second time and that's when the expanded text changed to $docs: . I explored further and found that this type of variable exists for each of my PSDrives, or at least tab expansion suggests that it does. More formally, for every PSDrive PSD , tab expansion believes

Iterate a windows ascii text file, find all instances of {LINE2 1-9999} replace with {LINE2 “line number the code is on”}. Overwrite. Faster?

和自甴很熟 提交于 2019-12-01 10:19:12
问题 This code works. I just want to see how much faster someone can make it work. Backup your Windows 10 batch file in case something goes wrong. Find all instances of string {LINE2 1-9999} and replace with {LINE2 "line number the code is on"}. Overwrite, encoding as ASCII. If _61.bat is: TITLE %TIME% NO "%zmyapps1%\*.*" ARCHIVE ATTRIBUTE LINE2 1243 TITLE %TIME% DOC/SET YQJ8 LINE2 1887 SET ztitle=%TIME%: WINFOLD LINE2 2557 TITLE %TIME% _*.* IN WINFOLD LINE2 2597 TITLE %TIME% %%ZDATE1%% YQJ25