-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrestart-vscode-silent.vbs
More file actions
65 lines (57 loc) · 2.87 KB
/
Copy pathrestart-vscode-silent.vbs
File metadata and controls
65 lines (57 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
' Silent launcher for VS Code with DevTools logging
' Completely invisible - no windows, no consoles
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Kill all VS Code processes (hidden)
objShell.Run "taskkill /F /IM Code.exe", 0, True
WScript.Sleep 2000
' Create logs directory if needed
If Not objFSO.FolderExists("C:\logs") Then
objFSO.CreateFolder("C:\logs")
End If
' Clear previous log
If objFSO.FileExists("C:\logs\vscode-devtools.log") Then
objFSO.DeleteFile("C:\logs\vscode-devtools.log")
End If
' Create timestamp formatter PowerShell script
Dim psScript
psScript = "C:\logs\format-log.ps1"
Set psFile = objFSO.CreateTextFile(psScript, True)
psFile.WriteLine "$raw = 'C:\logs\vscode-devtools-raw.log'"
psFile.WriteLine "$formatted = 'C:\logs\vscode-devtools.log'"
psFile.WriteLine "while ($true) {"
psFile.WriteLine " if (Test-Path $raw) {"
psFile.WriteLine " $content = Get-Content $raw -Raw -ErrorAction SilentlyContinue"
psFile.WriteLine " if ($content) {"
psFile.WriteLine " $lines = $content -split ""`n"""
psFile.WriteLine " $output = @()"
psFile.WriteLine " foreach ($line in $lines) {"
psFile.WriteLine " if ($line -match '^\[(\d+):(\d{2})(\d{2})/(\d{2})(\d{2})(\d{2})\.(\d+):') {"
psFile.WriteLine " $year = (Get-Date).Year"
psFile.WriteLine " $month = $matches[2]"
psFile.WriteLine " $day = $matches[3]"
psFile.WriteLine " $hour = $matches[4]"
psFile.WriteLine " $minute = $matches[5]"
psFile.WriteLine " $second = $matches[6]"
psFile.WriteLine " $ms = $matches[7]"
psFile.WriteLine " $timestamp = ""$year-$month-$day $hour:$minute:$second.$ms"""
psFile.WriteLine " $rest = $line -replace '^\[(\d+):(\d{2})(\d{2})/(\d{2})(\d{2})(\d{2})\.(\d+):', ''"
psFile.WriteLine " $output += ""[$timestamp]$rest"""
psFile.WriteLine " } else {"
psFile.WriteLine " $output += $line"
psFile.WriteLine " }"
psFile.WriteLine " }"
psFile.WriteLine " $output -join ""`n"" | Set-Content $formatted -Force"
psFile.WriteLine " }"
psFile.WriteLine " }"
psFile.WriteLine " Start-Sleep -Milliseconds 500"
psFile.WriteLine "}"
psFile.Close
' Set environment variables to log to raw file
Set objEnv = objShell.Environment("Process")
objEnv("ELECTRON_ENABLE_LOGGING") = "1"
objEnv("ELECTRON_LOG_FILE") = "C:\logs\vscode-devtools-raw.log"
' Start the formatter in background
objShell.Run "powershell.exe -WindowStyle Hidden -ExecutionPolicy Bypass -File """ & psScript & """", 0, False
' Launch VS Code with workspace (completely hidden, don't wait)
objShell.Run "cmd /c code ""C:\dev\continue-dev\continue-speech.code-workspace""", 0, False