# BSW.Blog

Calculate Excel Column Name By Number Using Powershell.

```function Get-ExcelCol{
param( [int]\$Number)
end{
[string]\$res=""
while(\$Number -gt 0 ) {
\$res= [System.Convert]::ToChar(((\$Number-1) % 26)  +65 ) +\$res
\$Number=(\$Number-((\$Number-1) % 26))/26

}
\$res
}

}
```

Result:

```PS C:\> Get-ExcelCol 26
Z

PS C:\> Get-ExcelCol 27
AA

PS C:\> Get-ExcelCol 52
AZ

PS C:\> Get-ExcelCol 53
BA
```

Babak
#Powershell #cmdlet #function #excel #column #Get-ExcelCol
##### Write Comment

Calculate 2000! In Powershell

Multiplying Big Numbers In Powershell And Calculate 2000! in seconds.

```function MUL {
param ([string]\$a ,[string]\$b)
[string]\$res=""
[bigint]\$m=0
\$a.Split()|%{
[bigint]\$c=[bigint]\$_*[bigint]\$b+\$m;
[bigint]\$d=\$c%10
\$m=(\$c-\$d)/10

\$res=\$res+\$d.ToString();
}
\$res=\$m.ToString()+\$res;
\$res
}
\$a=1
1..2000|%{\$a=mul \$a \$_;echo "\$(\$_)!=\$(\$a)"} |select -last 1
[system.gc]::Collect()

```

Result:

```PS C:\> C:\MUL.ps1
5!=120

PS C:\> C:\MUL.ps1
50!=30414093201713378043612608166064768844377641568960512000000000000

PS C:\> C:\MUL.ps1
500!=12201368259911100687012387854230469262535743428031928421924135883858453731538819976054964475022032818630136164771482035841633787220781772004807852051593292854779075
7193933060377296085908627042917454788242491272634430567017327076946106280231045264421887878946575477714986349436778103764427403382736539747138647787849543848959553753799
0423241061271326984327745715546309977202781014561081188373709531016356324432987029563896628911658974769572087926928871281780070265174507768410719624390394322536422605234
9458501299185715012487069615681416253590566934238130088562492468915641267756544818865065938479517753608940057452389403357984763639449053130623237490664450488246650759467
3586207463792518420045936969298102226397195259719094521782333175693458150855233282076282002340262690789834245171200620771464097945611612762914595123722991334016955236385
0942885592018727433795173014586357570828355780158735432768888680120399882384702151467605445407663535984174430480128938313896881639487469658817504506926365338175055478128
640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

PS C:\> C:\BigNumberMultiply\MUL.ps1
2000!=3316275092450633241175393380576324038281117208105780394571935437060380779056008224002732308597325922554023529412258341092580848174152937961313866335263436889056340
5855616394060511725257187064785639354404540524395746703767410872297043468415834375243158087753364512748799543685924740803240894656150723325065279765575717967153671868935
9056112815871601717232657156110004214012420433842573712700175883547796899921283528996665853405579854903657366350133386550401172012152635488038268152152246920995206031564
4185654806759464970515522882052348999957264508140655366789695321014676226713320268315522051944944616182392752040265297226315025747520482960647509273941658562835317795744
8287631459645037399132733417726360885249009350662161014445970941270782131373256383157230201994991495831647094277447387032798554967429860883937632682415247883438746959582
9257740574539837501585815468136294217949972399813599481016556563876034227312912250384709872909626622461971076605931550201895135583165357871492290916779049702247094611937
6077851651106844322559056487362665303773846503907880495246007125494026145660722541363027549136715834060978310749452822174907813477096932415561113398280513586006905946199
6525731074117708151992256451677857145805660218565476095237746301667942248844448579834980154803262082989096585738175188861937669282827988845358463989659421395298446529109
2009103710046149449915828588050761867924946385180879874512891408019340074625920057098729578599643650655895612410231018690556060308783629110505601245908998383410799367902
0520768586691834779065585447001486926569246319333376124280974200671728463619392496986284687199934503938893672704871271727345617003548674775091029555239535479411074219133
0135681954109194146276641754216158762526285808980122244389024867718205495941575199170127176757178749586161966593187885514183578209260148207177733173539603430496908207058
9958701381980813035590160762908388574561288217698136182483576739218303118414719133986892842344000779246691209766731651433494437473235636572048844478331854941693030124531
6762327453678793228474738244850922831399525097325059791270310476836014811911022292533726976938236700575656124002905760438528529029376064795334581796661238396052625491071
8666386935476610845504619810208405063582767652658949239324951968595417167241932953068367349554400458635983816104305944982662753060542358075589410827888042782595108988063
5410567917950974017780688782869810219010900148352061688883720250310665922068601483649830532782088263536558043605686781284169217133047141176312175895777122637584753123517
2309905498292101346873042058980144180638753826641698977042377594062808772537022654265305808623793014226758211871435029186376363403001732518182620760397473695952026426323
6414544685111342720215045838385101013694131303485622191663162389263276581535501127630782505996915882453345743543786368317373067329658935519969445823687350883027865770087
9749889992343555566240682834763784685183844973648873952475103224222110561201295829657191368108693825475764118886879346725191246192151144738836269591643672490071653428228
1526612478004639225449451703637236279407577845420910483054616561906221742869816029733240465202019928138548826819510072828697010707375009276664875021747753727423515087482
4672027417003158112280589617812216074743794751095062093855667458125251837668215771280786149925587613235295042234638787895485088576446613629039412766597804420209228133798
7115900896264878942413210454925003566670632909441579372986743421470507213588932019580723064781498429522595589012754823971773325722910325760929790733299545056388362640474
6502450808094691160726320874941439730007041114185955302788273576548191820024496977611113463181952827615909641897909581173386272060889104329452449785351470141124421430554
8608963957837834732532359576329143892528839398625627324286277556314046383038916842163311344563630957196597846633855149231619633567535513840342580416291983782226690952177
0153175338730284610841886554138329171951332117895728541662084823682817932512931237521541926970269703299477643823386483008871530373405666383868294088487730721762268849023
0849346611942601802726138021080050782157410060548482013478595781027707077806555127725405016743323960662532164150048087724030476119290322101543853531386855384864255707907
9534117651957118868373988068389579274374968349814292329219630977709014393684365533335930782018131299345502420604456334057860696247196150560339489952332180043435996725662
3927196435402872055475012079854331970674797313126813523653744085662263206768837585132782896252333284341812977624697079543436003492343159239674763638912115285406657783646
2139112474470512552263427012395270181270454916480459322481088586746009523067931759677555810116799400052498063037631413444122690370349873557999160092592480750524855415682
6628176081544630830540667741263012444186420410837311909313000115447056027777372437806718889977085105672727678124719883285769584421758889516046786820481001004781646235822
0838532488134270834079868486632162720208823308727819085378845469131556021728873121907393965209260229101477527080930865364979858554010577450279289814603688431821508637246
2169678722821693473705992862771124476909209029883201668301702734202597656717098633112163495021712644268271196502640542282317596308744753018471940955242634114984695080733
9008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
```

Babak
#Powershell #Number #Multiply #big #large #factorial #Fast #StringMultiply #HugeNumber #30414093201713378043612608166064768844377641568960512000000000000
##### Write Comment

Extract CSS Class Names From Multiple Files Using Regular Expression in Powershell.

```PS C:\> cat *.css| %{[System.Text.RegularExpressions.Regex]::Matches(\$_,"[^\d:](\.[\w-]{1,})[\ \{:\r\n\[]")} |%{\$_.Groups[1].value} |sort -Unique
```

```PS C:\css> cat *.css| %{[System.Text.RegularExpressions.Regex]::Matches(\$_,"(\.[^\d ][\w-]{1,})[ \r\n\t,:\{]*")} |%{\$_.Groups[1].value} |sort -Unique
```

and Again Upgraded Version

```PS C:\css> cat *.css| %{[System.Text.RegularExpressions.Regex]::Matches(\$_,"(?:[^\w])\.(?<g>[^\d/ ][\w-]{1,})|^\.(?<g>[^\d/ ][\w-]{1,})")} |%{\$_.Groups[1].value} |sort -Unique
```

Babak
#CSS #Powershell #Multiple #File #Class #CSS3 #Regex #Regular #Regexp #Regular Expression
##### Write Comment

View Internet Explorer 11 Cookies Using Powershell With simple script:

you can run the script below view your cookies without need to run applications so you'll be sure about malware and viruses in application.

soon I'll create the cookie manager script

Tested on Windows 8.1 with IE11

```dir "\$([Environment]::GetFolderPath("Cookies"))\low" | %{
\$str=(cat \$_.fullname);
\$q=New-Object "System.Collections.Generic.Queue[string]"
\$str|%{\$q.Enqueue(\$_)}
while(\$q.Count -gt 0 ){
New-Object psobject -Property (@{
Name=\$q.Dequeue();
Value=\$q.Dequeue();
Domain=\$q.Dequeue();
Flags=\$q.Dequeue();
Expire= [System.DateTime]::FromFileTime([long]\$q.Dequeue()+[long]\$q.Dequeue()*[math]::pow(2,32)) ;
Creation=  [System.DateTime]::FromFileTime([long]\$q.Dequeue()+[long]\$q.Dequeue()*[math]::pow(2,32)) ;
Delim=\$q.Dequeue();
Filename=\$_.Name;
}
)
}
} | Out-GridView

```

Babak
#Powershell #File #safe #Script #Windows #IE #IE11 #InternetExplorer #Source #Cookie #Cookies #View Cookies #GridView #Parse #Parse Cookie #Parse Cookie Files #Browse #free #Generic #Collections #Queue #GenericQueue