Skip to content

Releases

v1.4.2

Choose a tag to compare

@j0p3s j0p3s released this 31 Oct 03:10
ccfd3d1

Release v1.4.2

Title: v1.4.2 - Collects the files the script creates, PowerShell run from memory, admin-aware runs

What's new

  • Files the script creates are collected. Tools often write their own log, report or settings while they run. Debug-CMD now finds the .log, .txt, .json, .csv, .xml and .ini files created or changed during the run, in the script's folder and in folders the script mentions (C:\Name, %SystemDrive%\Name, $env:ProgramData 'Name'...). Their contents go into the .log and the .html, and lines that look like errors are marked. New options: COLLECT_FILES (default 1) and COLLECT_DIRS (extra folders, separated by semicolons).
  • Single-file tools are captured. Scripts that read their own PowerShell and run it from memory (Invoke-Expression) are no longer a black box: the code is cut out exactly like PowerShell does, logged with line numbers, and saved as <name>_debug_<date>.embedded1.ps1.
  • Every .ps1 logged: files written or run by the script (even temporary ones it deletes), each PowerShell process it starts, decoded -EncodedCommand payloads, and full command lines.
  • Administrator-aware (ELEVATE=AUTO, new default): if the script contains runas, fltmc, net session and similar, Debug-CMD relaunches itself as administrator (one UAC prompt) so it can follow scripts that restart themselves elevated. The elevated window stays open so errors remain visible.
  • Honest status: if a script restarted itself as administrator and could not be followed, the report says INCOMPLETE - RESTARTED AS ADMIN instead of OK.
  • HTML report now has the PowerShell section, "Run from memory" and "Files collected" cards, and the collected files with highlighted error lines.

Fixes

  • Folder detection ignores names like C:\. that pointed at the whole drive.

  • The report now always lists the folders it searched for created files, even when none were found.

  • set "PSEXE=...powershell.exe" and if exist ... set ... lines are no longer counted as PowerShell runs (debug and test mode).

  • Test mode no longer analyzes embedded PowerShell as batch code: no more false "file not found" and "label does not exist" errors on single-file tools.

Notes

  • Windows only. Tested on Windows 10.
  • Only text files with the extensions above are collected, from at most 15 folders, 4 levels deep. Files over 1 MB show only their last 200 KB.

v1.4.1

Choose a tag to compare

@j0p3s j0p3s released this 31 Oct 03:06
ccfd3d1

Release v1.4.1

Title: v1.4.1 - Collects the files the script creates, PowerShell run from memory, admin-aware runs

What's new

  • Files the script creates are collected. Tools often write their own log, report or settings while they run. Debug-CMD now finds the .log, .txt, .json, .csv, .xml and .ini files created or changed during the run, in the script's folder and in folders the script mentions (C:\Name, %SystemDrive%\Name, $env:ProgramData 'Name'...). Their contents go into the .log and the .html, and lines that look like errors are marked. New options: COLLECT_FILES (default 1) and COLLECT_DIRS (extra folders, separated by semicolons).
  • Single-file tools are captured. Scripts that read their own PowerShell and run it from memory (Invoke-Expression) are no longer a black box: the code is cut out exactly like PowerShell does, logged with line numbers, and saved as <name>_debug_<date>.embedded1.ps1.
  • Every .ps1 logged: files written or run by the script (even temporary ones it deletes), each PowerShell process it starts, decoded -EncodedCommand payloads, and full command lines.
  • Administrator-aware (ELEVATE=AUTO, new default): if the script contains runas, fltmc, net session and similar, Debug-CMD relaunches itself as administrator (one UAC prompt) so it can follow scripts that restart themselves elevated. The elevated window stays open so errors remain visible.
  • Honest status: if a script restarted itself as administrator and could not be followed, the report says INCOMPLETE - RESTARTED AS ADMIN instead of OK.
  • HTML report now has the PowerShell section, "Run from memory" and "Files collected" cards, and the collected files with highlighted error lines.

Fixes

  • The report now always lists the folders it searched for created files, even when none were found.

  • set "PSEXE=...powershell.exe" and if exist ... set ... lines are no longer counted as PowerShell runs (debug and test mode).

  • Test mode no longer analyzes embedded PowerShell as batch code: no more false "file not found" and "label does not exist" errors on single-file tools.

Notes

  • Windows only. Tested on Windows 10.
  • Only text files with the extensions above are collected, from at most 15 folders, 4 levels deep. Files over 1 MB show only their last 200 KB.

v1.4.0

Choose a tag to compare

@j0p3s j0p3s released this 31 Oct 03:00
b16c94b

Release v1.4.0

Title: v1.4.0 - Collects the files the script creates, PowerShell run from memory, admin-aware runs

What's new

  • Files the script creates are collected. Tools often write their own log, report or settings while they run. Debug-CMD now finds the .log, .txt, .json, .csv, .xml and .ini files created or changed during the run, in the script's folder and in folders the script mentions (C:\Name, %SystemDrive%\Name, $env:ProgramData 'Name'...). Their contents go into the .log and the .html, and lines that look like errors are marked. New options: COLLECT_FILES (default 1) and COLLECT_DIRS (extra folders, separated by semicolons).
  • Single-file tools are captured. Scripts that read their own PowerShell and run it from memory (Invoke-Expression) are no longer a black box: the code is cut out exactly like PowerShell does, logged with line numbers, and saved as <name>_debug_<date>.embedded1.ps1.
  • Every .ps1 logged: files written or run by the script (even temporary ones it deletes), each PowerShell process it starts, decoded -EncodedCommand payloads, and full command lines.
  • Administrator-aware (ELEVATE=AUTO, new default): if the script contains runas, fltmc, net session and similar, Debug-CMD relaunches itself as administrator (one UAC prompt) so it can follow scripts that restart themselves elevated. The elevated window stays open so errors remain visible.
  • Honest status: if a script restarted itself as administrator and could not be followed, the report says INCOMPLETE - RESTARTED AS ADMIN instead of OK.
  • HTML report now has the PowerShell section, "Run from memory" and "Files collected" cards, and the collected files with highlighted error lines.

Fixes

  • set "PSEXE=...powershell.exe" and if exist ... set ... lines are no longer counted as PowerShell runs (debug and test mode).
  • Test mode no longer analyzes embedded PowerShell as batch code: no more false "file not found" and "label does not exist" errors on single-file tools.

Notes

  • Windows only. Tested on Windows 10.
  • Only text files with the extensions above are collected, from at most 15 folders, 4 levels deep. Files over 1 MB show only their last 200 KB.

v1.3.0

Choose a tag to compare

@j0p3s j0p3s released this 31 Oct 02:51
b16c94b

Release v1.3.0

Title: v1.3.0 - Logs PowerShell run from memory, admin-aware runs, cleaner test mode

What's new

  • Single-file tools are now captured. Scripts that read their own PowerShell and run it from memory (Invoke-Expression) no longer log nothing. Debug-CMD finds the marker (e.g. #PS-BEGIN), cuts the code out exactly like PowerShell does, logs it with line numbers, and saves it as <name>_debug_<date>.embedded1.ps1.
  • Every .ps1 logged: files written or run by the script (even temporary ones it deletes), each PowerShell process it starts, and decoded -EncodedCommand payloads. Full command lines are kept in the log.
  • Administrator-aware (ELEVATE=AUTO, new default): if the script contains runas, fltmc, net session and similar, Debug-CMD relaunches itself as administrator (one UAC prompt) so it can follow scripts that restart themselves elevated. The elevated window stays open so errors remain visible.
  • Honest status: if a script restarted itself as administrator and could not be followed, the report says INCOMPLETE - RESTARTED AS ADMIN instead of OK.
  • HTML report updated with the PowerShell section, "Run from memory" cards and full command lines.

Fixes

  • set "PSEXE=...powershell.exe" and if exist ... set ... lines are no longer counted as PowerShell runs.
  • Test mode no longer analyzes embedded PowerShell as batch code: no more false "file not found" and "label does not exist" errors on single-file tools.

Notes

  • Capturing what happens inside a GUI is limited to what the script runs and writes; files the tool creates on its own are not collected yet.
  • Windows only. Tested on Windows 10.

Debug-CMD v1.1.0

Choose a tag to compare

@j0p3s j0p3s released this 31 Oct 01:50
0a1cf09

Debug-CMD v1.1.0

Debug-CMD now logs the PowerShell your script runs, including tools that keep their PowerShell inside the .cmd and never write a .ps1 to disk.

New

  • PowerShell logging (LOG_PS1, on by default): the log keeps the full contents of every .ps1 the script writes or runs (even temporary ones it deletes right after), every PowerShell it starts (even when the command isn't echoed), decoded -EncodedCommand payloads, and the line where PowerShell reported an error.
  • Single-file .cmd tools: when PowerShell reads code from a file and runs it with Invoke-Expression / iex (for example $t.Substring($t.IndexOf('#PS-BEGIN')) or iex (${file.cmd} | out-string)), Debug-CMD cuts out the same code, logs it with line numbers, and saves it next to the log as <name>_debug_<date>.embedded1.ps1. PowerShell's At line:N numbers match that file.
  • ELEVATE=AUTO (new default): if the script asks for administrator rights (runas, fltmc, net session...), Debug-CMD runs as administrator so everything can be captured. Before, a script that restarted itself as administrator opened a window Debug-CMD couldn't follow.
  • Warning for self-elevating scripts: if one still restarts itself elsewhere, the log says so and keeps the temporary __dbg_ copy.
  • Full PowerShell command lines are written to the log, and the .ps1 listing limit went from 5,000 to 20,000 lines, so large single-file tools fit.
  • Test mode also scans inline and encoded PowerShell and the .ps1 files the script uses.

Changed

  • ELEVATE now takes 0, 1 or AUTO (default AUTO, before 0).
  • .gitignore also ignores the saved *_debug_*.ps1 files.

Usage

  1. Download Debug-CMD.cmd (below).
  2. Drag your .cmd or .bat onto it.
  3. Choose E to execute and debug, or T to test only.

Known limitations

  • PowerShell code built or downloaded at run time (for example iex (irm https://...)) can't be cut out of a file. Its command line is logged in full, but the code is not.
  • A script that restarts itself as administrator can only be followed if Debug-CMD runs as administrator.
  • Errors are detected by keywords in the output (English and Portuguese), so some may be missed and false positives are possible.
  • Debug mode really runs your script. Use test mode first if you are unsure.

Requirements

Windows 10 or 11 with Windows PowerShell 5.1 (included).

Feedback

Not yet tested on Windows beyond the logic checks, so please open an issue with the .log if something is missed or misreported.

Debug-CMD v1.0.0-beta.1

Pre-release

Choose a tag to compare

@j0p3s j0p3s released this 21 Oct 22:43
4752c82

Debug-CMD v1.0.0

Drag a .cmd or .bat file onto Debug-CMD.cmd and get a timestamped log of everything it did, plus a summary of what worked and what failed. One file, nothing to install: it uses the PowerShell that already ships with Windows 10/11.

Highlights

  • Safe test mode: choose T to only analyze a script. Nothing is executed. It flags dangerous commands (delete, format, registry, shutdown, downloads...) and broken goto/call targets.
  • Command-by-command debugging: runs a temporary copy of your script with echo on, so the log shows each command before its output. Your original is never modified.
  • Easy-to-read HTML report: a self-contained page (works offline, light/dark theme) with a status badge, summary cards, expandable failed commands, a list of what worked, and a filterable full log.
  • Timestamped .log: every line has a time with milliseconds, with a summary at the top.
  • Hands-off: pause commands in the copy are skipped so the script runs to the end.
  • Robust: on Ctrl+C the log and report are still saved, the process is stopped, and the temporary copy is deleted.
  • Not frozen: during long, silent commands it prints "running for mm:ss" every 10 seconds.

Usage

  1. Download Debug-CMD.cmd (below).
  2. Drag your .cmd or .bat onto it.
  3. Choose E to execute and debug, or T to test only.

Options

Edit the top of Debug-CMD.cmd: ELEVATE, ECHO_ON, SKIP_PAUSE, OPEN_REPORT, GENERATE_HTML and MODE (ASK, RUN or TEST). See the README for details.

Known limitations

  • Errors are detected by keywords in the output (English and Portuguese), so some may be missed and some false positives are possible.
  • Test mode is a static keyword scan: it does not expand variables or follow scripts it calls. It lowers risk, it does not guarantee safety.
  • Commands using >nul 2>&1 hide their own errors.
  • Only the dragged script is forced to echo on; scripts it launches with call keep their own echo off.
  • Debug mode really runs your script. Use test mode first if you are unsure.

Requirements

Windows 10 or 11 with Windows PowerShell 5.1 (included).

Feedback

Tested so far on Windows 10 Pro. Please open an issue if something breaks or a command is misclassified.