Skip to content

Instantly share code, notes, and snippets.

@kshyju
Created December 16, 2024 21:23
Show Gist options
  • Save kshyju/b56f307edfad0938cd5f6533ca6c5531 to your computer and use it in GitHub Desktop.
Save kshyju/b56f307edfad0938cd5f6533ca6c5531 to your computer and use it in GitHub Desktop.
# Create a directory
$directoryPath = "C:\ExampleDirectory"
New-Item -ItemType Directory -Path $directoryPath -Force
# Create a file in the directory
$filePath = "$directoryPath\example.txt"
"Hello, World!" | Out-File -FilePath $filePath
# Output the result
Write-Output "Directory and file created successfully."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment