Skip to content

Commit 64b8ba0

Browse files
committed
chore: windows
1 parent 9560df9 commit 64b8ba0

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
export module win {
2+
3+
# open in visual studio
4+
export def "open in visual-studio" [file: path] {
5+
let vswhere = $'($env."ProgramFiles(x86)")\Microsoft Visual Studio\Installer\vswhere.exe'
6+
if not ($vswhere | path exists) { error make {msg: $"($vswhere) not found" } }
7+
8+
# https://github.com/microsoft/vswhere/wiki/Find-VC
9+
let latest = ^$vswhere -latest | parse "{property}: {value}"
10+
let installation_path = $latest | transpose --header-row | get installationPath.0
11+
let vs = $'($installation_path)\Common7\IDE\devenv.exe'
12+
if not ($vs | path exists) { error make {msg: $"($vs) not found" } }
13+
14+
run-external $vs /Edit ($file | path expand)
15+
}
16+
17+
# file version and signature viewer from file
18+
export def "read version" [file: path] {
19+
^sigcheck -nobanner $file | lines | skip 1 | parse --regex '\s*(?<name>.+?):(?<value>.+)'
20+
}
21+
22+
# application for CPU spikes, unhandled exception and hung window monitoring cli tool
23+
#
24+
# https://learn.microsoft.com/en-us/sysinternals/downloads/procdump#using-procdump
25+
#
26+
# Examples:
27+
# Install ProcDump as the (AeDebug) postmortem debugger:
28+
# procdump -ma -i c:\dumps
29+
#
30+
# Uninstall ProcDump as the (AeDebug) postmortem debugger:
31+
# procdump -u
32+
export extern "procdump" [ ...args: any ]
33+
34+
# list logical disks somehing akin to unix's df command
35+
export def "disk free" [] {
36+
(wmic logicaldisk get deviceid,size,freespace,volumename,description | str trim
37+
| detect columns
38+
| insert Use% { ($in.freespace|into int) / ($in.size|into int) * 100 }
39+
)
40+
}
41+
42+
}

0 commit comments

Comments
 (0)