Skip to content

Commit a6d8ff5

Browse files
committed
chore: windows
1 parent 9560df9 commit a6d8ff5

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
export module win {
2+
3+
# open in visual studio
4+
export def "open in visual-studio" [file: path] {
5+
let file = ($file | path expand)
6+
let vs = 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\devenv.exe'
7+
if (not ($vs | path exists)) {
8+
error make {msg: $"($vs) not found, please edit 'open in visual-studio' function in ($env.CURRENT_FILE)" }
9+
}
10+
run-external $vs /Edit $file
11+
}
12+
13+
def "nu-complete procs" [] { ps | select pid name | sort-by name | rename -c { pid: value, name: description } }
14+
15+
export def "windbg attach-to-process" [
16+
--pid(-p): int@"nu-complete procs" # process-id
17+
] {
18+
let windbg = '~/AppData/Local/Microsoft/WindowsApps/WinDbgX.exe'
19+
if (not ($windbg | path exists)) {
20+
error make {msg: $"($windbg) not found, please edit 'windbg attach-to-process' function in ($env.CURRENT_FILE)" }
21+
}
22+
run-external $windbg "-p" $pid
23+
}
24+
25+
# file version and signature viewer from file
26+
export def "read version" [file: path] {
27+
^sigcheck -nobanner $file | lines | skip 1 | parse --regex '\s*(?<name>.+?):(?<value>.+)'
28+
}
29+
30+
# application for CPU spikes, unhandled exception and hung window monitoring cli tool
31+
#
32+
# https://learn.microsoft.com/en-us/sysinternals/downloads/procdump#using-procdump
33+
#
34+
# Examples:
35+
# Install ProcDump as the (AeDebug) postmortem debugger:
36+
# procdump -ma -i c:\dumps
37+
#
38+
# Uninstall ProcDump as the (AeDebug) postmortem debugger:
39+
# procdump -u
40+
export extern "procdump" [ ...args: any ]
41+
42+
}
43+

0 commit comments

Comments
 (0)