Skip to content

github/awesome-copilot / skills/batch-files

batch-files

Unverified

Expert-level Windows batch file (.bat/.cmd) skill for writing, debugging, and maintaining CMD scripts. Use when asked to "create a batch file", "write a .bat script", "automate a Windows task", "CMD scripting", "batch automation", "scheduled task script", "Windows shell script", or when working with .bat/.cmd files in the workspace. Covers cmd.exe syntax, environment variables, control flow, string processing, error handling, and integration with system tools.

references/cygwin.md

View on GitHub
# Cygwin Reference

Cygwin provides a large collection of GNU and Open Source tools that provide functionality similar to a Linux distribution on Windows, plus a POSIX API DLL (`cygwin1.dll`) for substantial Linux API compatibility.

## Documentation

- [Cygwin User's Guide](https://cygwin.com/cygwin-ug-net.html) — comprehensive official documentation
- [Cygwin FAQ](https://cygwin.com/faq.html)
- [Cygwin Homepage](https://cygwin.com/)

## User's Guide — Table of Contents

### Chapter 1: Cygwin Overview

- **What is it?** — POSIX compatibility layer and GNU toolset for Windows
- **Quick Start Guide (Windows users)** — Getting started for those familiar with Windows
- **Quick Start Guide (UNIX users)** — Getting started for those familiar with UNIX/Linux
- **Are the Cygwin tools free software?** — Licensing (GPL/LGPL)
- **A brief history of the Cygwin project** — Origins and evolution
- **Highlights of Cygwin Functionality**
  - Permissions and Security
  - File Access
  - Text Mode vs. Binary Mode
  - ANSI C Library
  - Process Creation
  - Signals
  - Sockets and Select
- **What's new and what changed** — Release notes for all versions (1.7.x through 3.6)

### Chapter 2: Setting Up Cygwin

- **Internet Setup** — Installing via `setup-x86_64.exe`, mirror selection, package management
- **Environment Variables** — Configuring `PATH`, `HOME`, `CYGWIN` and other environment variables
- **Changing Cygwin's Maximum Memory** — Adjusting memory limits via the registry
- **Internationalization** — Locale and character set configuration
- **Customizing bash** — `.bashrc`, `.bash_profile`, and prompt customization

### Chapter 3: Using Cygwin

- **Mapping path names** — How Cygwin maps POSIX paths to Windows paths (`/cygdrive/c` = `C:\`)
- **Text and Binary modes** — Line ending handling (`\n` vs `\r\n`), mount options
- **File permissions** — POSIX permission model on NTFS, ACLs
- **Special filenames** — Device files, `/proc`, `/dev`, socket files
- **POSIX accounts, permission, and security** — User/group mapping, `passwd`/`group` files, `ntsec`
- **Cygserver** — Background service for shared memory, message queues, semaphores
- **Cygwin Utilities** — Built-in command-line tools:
  - `cygcheck` — System information and package diagnostics
  - `cygpath` — Convert between POSIX and Windows paths
  - `cygstart` — Open files/URLs with associated Windows applications
  - `dumper` — Create Windows minidumps
  - `getconf` — Query POSIX system configuration
  - `getfacl` / `setfacl` — Get/set file access control lists
  - `ldd` — List shared library dependencies
  - `locale` — Display locale information
  - `minidumper` — Write a minidump of a running process
  - `mkgroup` / `mkpasswd` — Generate group/passwd entries from Windows accounts
  - `mount` / `umount` — Manage Cygwin mount table
  - `passwd` — Change passwords
  - `pldd` — List loaded DLLs for a process
  - `profiler` — Profile Cygwin programs
  - `ps` — List running processes
  - `regtool` — Access the Windows registry from the shell
  - `setmetamode` — Control meta key behavior in the console
  - `ssp` — Single-step profiler
  - `strace` — Trace system calls and signals
  - `tzset` — Print POSIX-compatible timezone string
- **Case-sensitive directories** — Enabling per-directory case sensitivity on Windows 10+
- **Using Cygwin effectively with Windows** — Integration tips, running Windows programs from Cygwin

### Chapter 4: Programming with Cygwin

- **Using GCC with Cygwin** — Compiling C/C++ programs with the Cygwin GCC toolchain
- **Debugging Cygwin Programs** — Using GDB and other debugging tools
- **Building and Using DLLs** — Creating shared libraries under Cygwin
- **Defining Windows Resources** — Resource files and `windres`
- **Profiling Cygwin Programs** — Performance profiling with `gprof` and `ssp`

## Key Concepts for Batch Scripting

### Invoking Cygwin from Batch Files

```batch
REM Run a Cygwin command from a batch file
C:\cygwin64\bin\bash.exe -l -c "ls -la /home"

REM Convert a Windows path to POSIX for Cygwin
C:\cygwin64\bin\cygpath.exe -u "C:\Users\John Doe\Documents"

REM Convert a POSIX path back to Windows
C:\cygwin64\bin\cygpath.exe -w "/home/jdoe/project"
```

### Common Environment Variables

| Variable | Purpose |
|----------|---------|
| `CYGWIN` | Runtime options (e.g., `nodosfilewarning`, `winsymlinks:nativestrict`) |
| `HOME` | User home directory |
| `PATH` | Must include `/usr/local/bin:/usr/bin` for Cygwin tools |
| `SHELL` | Default shell (typically `/bin/bash`) |
| `TERM` | Terminal type for console applications |
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall