New_Folder_dev.ps1 453 B

12345678910111213141516
  1. # Prompt user to input folder name
  2. $folderName = Read-Host "Enter the name of the folder:"
  3. # Create the folder
  4. New-Item -ItemType Directory -Path $folderName
  5. # Get current date and time
  6. $currentDateTime = Get-Date -Format "dd.MM.yyyy-HH.mm"
  7. # Create empty text file with current date and time as title
  8. $file = "$folderName\$currentDateTime.txt"
  9. New-Item -ItemType File -Path $file
  10. # Write current name of folder in file
  11. $folderName | Out-File $file