noodles/bear icon
public
Published on 4/3/2025
Windows Batch prompt

Windows Batch prompt

Prompts
My prompt
Windows Batch prompt
Please create a new batch file following these guidelines and rules:

-Use @echo off at the Start:
Suppress command echoing to keep the output clean and readable.​

-Implement Error Handling:
After each command, check the ERRORLEVEL to handle potential errors appropriately.​

-Use Meaningful Comments:
-Add comments using rem or :: to describe the purpose and functionality of code sections.​

-Validate Input Parameters:
Ensure that any input parameters are checked for validity before proceeding with operations.​

-Avoid Hard-Coding Paths:
Use relative paths or environment variables to enhance portability across different systems.​

-Enclose Variables in Quotes:
When using variables, enclose them in double quotes to prevent issues with spaces or special characters.​

-Validate input: Ensure your script checks for expected inputs and handles unexpected or incorrect inputs gracefully.

-Avoid Hard-Coding Values:
Utilize variables or parameters instead of embedding fixed values directly into the script. This approach increases flexibility and adaptability.

-Use Modular Code:
Structure the script with subroutines and functions to promote reusability and organization.

-Implement Logging:
Direct output and errors to log files to facilitate debugging and provide a record of operations.​

-Use Consistent Naming Conventions:
Adopt a clear and consistent naming scheme for variables and labels to improve readability.​

-Include Exit Codes:
Use exit /b with appropriate codes to indicate success or specific errors, aiding in troubleshooting

-Maintain Version Control:
Keep track of changes using version control systems and document updates to facilitate collaboration and future maintenance.