An IT technician is reviewing system administrative scripts used for environment management across Windows and Linux platforms. Match each script code snippet to the specific language construct or behavior it exhibits.
- for /f "tokens=1-2" %%a in (C:\logs\audit.txt) do ( echo %%a %%b )Windows Batch iteration construct parsing structured file tokens natively in cmd.exe
- Get-ChildItem -Path C:\Logs | Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-30) }PowerShell pipeline construct passing object properties to perform conditionally filtered operations
- Set objFSO = CreateObject("Scripting.FileSystemObject")VBScript COM object instantiation construct using Windows Script Host (WSH)
- if [ -d "/var/log/backup" ]; then echo "Directory exists"; fiBash shell conditional evaluation construct testing directory existence in POSIX environments
Cevap
1. 'for /f "tokens=1-2" %%a in (...)' matches 'Windows Batch iteration construct parsing structured file tokens natively in cmd.exe'.
2. 'Get-ChildItem -Path ... | Where-Object { $_.LastWriteTime ... }' matches 'PowerShell pipeline construct passing object properties to perform conditionally filtered operations'.
3. 'Set objFSO = CreateObject("Scripting.FileSystemObject")' matches 'VBScript COM object instantiation construct using Windows Script Host (WSH)'.
4. 'if [ -d "/var/log/backup" ]; then echo "Directory exists"; fi' matches 'Bash shell conditional evaluation construct testing directory existence in POSIX environments'.
2. 'Get-ChildItem -Path ... | Where-Object { $_.LastWriteTime ... }' matches 'PowerShell pipeline construct passing object properties to perform conditionally filtered operations'.
3. 'Set objFSO = CreateObject("Scripting.FileSystemObject")' matches 'VBScript COM object instantiation construct using Windows Script Host (WSH)'.
4. 'if [ -d "/var/log/backup" ]; then echo "Directory exists"; fi' matches 'Bash shell conditional evaluation construct testing directory existence in POSIX environments'.
Each snippet represents a distinct script language's syntax: Batch uses 'for /f' for file parsing, PowerShell uses cmdlets with pipeline object parameters ('$_.'), VBScript uses 'CreateObject' to instantiate COM interfaces under WSH, and Bash uses square bracket conditional tests ('[ -d ... ]') closed with 'fi'.
Adım Adım Çözüm
Anahtar Kavram
Identification of scripting language constructs, execution environments, and basic control flows across Windows Batch, PowerShell, VBScript, and Bash.