Buradasın
Windows Batch Scripting Variables Guide
steve-jansen.github.io/guides/windows-batch-scripting/part-2-variables.htmlYapay zekadan makale özeti
- Basic Concepts
- DOS doesn't require variable declaration, undeclared variables are empty strings
- SET command assigns values to variables without whitespace
- Lowercase names recommended for script variables, uppercase for system variables
- SET always overwrites existing variables
- Variable Scope
- Variables are global by default, can be made local with SETLOCAL
- SETLOCAL variables persist until ENDLOCAL or script exit
- System-wide variables like %TEMP% should not be overwritten
- Command Line Arguments
- Command line arguments accessed using % followed by ordinal position
- %0 represents script name, %1-9 represent command line arguments
- SHIFT command needed for arguments above %10
- Special macros available for file path manipulation
- Best Practices
- Include SETLOCAL and ENABLEEXTENSIONS at script top
- Store script name in %me% variable
- Use %parent% for script directory paths
- Verify variable names don't overwrite system variables