Using Powershell to automate creating company directory and renaming cover letter and resume












0












$begingroup$


I'm in the middle of job searching and while doing so, I have to create a folder for the company and position, then move my base cover letter and resume to that folder and begin customizing the document.



I've decided to automate the task with Powershell v4.



<#
Job Application Preparation
The script asks the user for the company name and job then proceeds
to create the company folder, move, and rename the base cover letter and resume.

Version: 1.5
#>

# Resume Storage Location
$workBase = [string]::Empty
$resumeCoverletterBase = [string]::Empty
$settings = "$PSScriptRootsettings.txt"

function verifyifparameterisempty
{ Param( [Parameter(Mandatory=$true)]
$parametertoverify,
[Parameter(Mandatory=$true)]
$parameterType
)

<#
Determines if a string is null or contians whitespace.
If it does, it will throw and display what was missing using the $parameterType
Args:
string: $parametertoverify - the string we're going to test
string: $parameterType - what the string represents

Return:
None
#>

if([string]::IsNullOrWhiteSpace($parametertoverify)){
throw [System.ArgumentNullException] "$parameterType"
}
}

function determineIfFileorDirectoryExists
{ Param( [Parameter(Mandatory=$true)]
[string]$fileordirectory)

<#
Determine if a File or Directory Exists. If the file or directory doesn't exists,
it will throw an exception.
Args:
[string] $fileordirectory - the variable that contains the file or directory
we're going to Test.
Returns:
None
#>

$fileordirectoryExists = Test-Path $fileordirectory

if($fileordirectoryExists -eq $false){
throw [System.IO.DirectoryNotFoundException] "Not Found: $fileordirectory"
}
}

function promptUserwithQuestion
{ Param([Parameter(Mandatory=$true)]
[string]$question)

<#
Prompts the user with a question accepts, trims and returns the answer
Args:
[string]$question - the variable that holds the question
Returns:
[string]$answer: the variable that holds the user provided answer.
#>


[string]$answer = Read-Host $question
return $answer.Trim()
}

try{

# Determine if the settings file exists
$doesSettingsFileExist = Test-Path $settings

# If the settings file doesn't exist, create one for the user, and store in the script location
if($doesSettingsFileExist -eq $false){
$userProvidedPath = promptUserwithQuestion -question "Full Path to Resume"
verifyifparameterisempty -parametertoverify $userProvidedPath -parameterType "Resume Path"
Add-Content -Path $settings -Value $userProvidedPath.Trim()
}

$pathToResume = Get-Content $settings

$workBase = Split-Path -Parent $pathToResume
$resumeCoverletterBase = Split-Path -Leaf $pathToResume
$extention = $resumeCoverletterBase.Split(".")[1]

<#
Call the promptUserwithQuestion function and ask for the company name and job position.
Afterward, verify that the user provided answers aren't blank
#>
$companyName = promptUserwithQuestion -question "Enter Company Name"
verifyifparameterisempty -parametertoverify $companyName -parameterType "Company Name"

$position = promptUserwithQuestion -question "Enter Job Position"
verifyifparameterisempty -parametertoverify $position -parameterType "Position"

# Combine the work base and company name for the folder name.
$companyResumeandCoverLetterDirectory = Join-Path -Path $workBase -ChildPath $companyName

$positionLoweredwithUnderscore = $position.ToLower().trim().replace(" ","_")

$companyResumeandCoverLetterDirectorywithPosition = Join-Path -Path $companyResumeandCoverLetterDirectory -ChildPath $positionLoweredwithUnderscore

$doesComanyDirectorywithPositionExists = Test-Path $companyResumeandCoverLetterDirectorywithPosition

if($doesComanyDirectorywithPositionExists -eq $false){

md $companyResumeandCoverLetterDirectorywithPosition

Write-Output ([string]::Format("Copying {0} to {1}",$pathToResume, $companyResumeandCoverLetterDirectorywithPosition))
Copy-Item -Path $pathToResume -Destination $companyResumeandCoverLetterDirectorywithPosition

$completePathToresumeCoverletterwithPosition = Join-Path -Path $companyResumeandCoverLetterDirectorywithPosition -ChildPath $resumeCoverletterBase

# Create a new name for our resume that includes the position name and extension.
$resumeCoverletterwithPosition = [string]::Format("cover_letter_resume_{0}.{1}",$positionLoweredwithUnderscore,$extention)

# Construct a path to the renamed cover letter and resume with extension.
$renamedPathToresumeCoverletterwithPosition = Join-Path $companyResumeandCoverLetterDirectorywithPosition -ChildPath $resumeCoverletterwithPosition

# Rename the base cover letter and resume.
Write-Output([string]::Format("Renaming {0} to {1}",$completePathToresumeCoverletterwithPosition, $renamedPathToresumeCoverletterwithPosition))
Rename-Item -Path $completePathToresumeCoverletterwithPosition -NewName $renamedPathToresumeCoverletterwithPosition

# Open the resume and cover letter in LibreOffice
Invoke-Item $renamedPathToresumeCoverletterwithPosition
}

}

catch [System.ArgumentNullException]{
Write-Output $PSItem.Exception.Message
}

catch [System.ArgumentException]{
Write-Output $PSItem.Exception.Message
}

catch [System.IO.DirectoryNotFoundException]{
Write-Output $PSItem.Exception.Message
}

catch [System.IO.IOException]{
Write-Output $PSItem.Exception.Message
}

catch [System.Exception]{
Write-Output $PSItem.Exception.Message
}

finally{
exit
}


Explanation:



When the user starts the script, it does the following:




  • Checks for the settings.txt file. If one isn't present, it creates one to store the location of the base resume and cover letter. When the user runs the script again, as long as settings.txt is present, it won't prompt for base location again. For example, R:Workcover_letter_resume_base.odt


  • The user is prompted for the company name and position, and the scripts lowers,trims,and strips the position and creates the directories. For example, if the company name was Microsoft and the position was Sofware Eng, the directory is R:WorkMicrosoftsoftware_eng. Using split-path it takes the location of the cover_letter_resume_base.odt in this case R:Work and creates the directories.


  • Finally it renames the document according to the user input, so R:WorkMicrosoftsoftware_engcover_letter_resume_software_eng.odt and opens it.










share







New contributor




EmilyScott is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$

















    0












    $begingroup$


    I'm in the middle of job searching and while doing so, I have to create a folder for the company and position, then move my base cover letter and resume to that folder and begin customizing the document.



    I've decided to automate the task with Powershell v4.



    <#
    Job Application Preparation
    The script asks the user for the company name and job then proceeds
    to create the company folder, move, and rename the base cover letter and resume.

    Version: 1.5
    #>

    # Resume Storage Location
    $workBase = [string]::Empty
    $resumeCoverletterBase = [string]::Empty
    $settings = "$PSScriptRootsettings.txt"

    function verifyifparameterisempty
    { Param( [Parameter(Mandatory=$true)]
    $parametertoverify,
    [Parameter(Mandatory=$true)]
    $parameterType
    )

    <#
    Determines if a string is null or contians whitespace.
    If it does, it will throw and display what was missing using the $parameterType
    Args:
    string: $parametertoverify - the string we're going to test
    string: $parameterType - what the string represents

    Return:
    None
    #>

    if([string]::IsNullOrWhiteSpace($parametertoverify)){
    throw [System.ArgumentNullException] "$parameterType"
    }
    }

    function determineIfFileorDirectoryExists
    { Param( [Parameter(Mandatory=$true)]
    [string]$fileordirectory)

    <#
    Determine if a File or Directory Exists. If the file or directory doesn't exists,
    it will throw an exception.
    Args:
    [string] $fileordirectory - the variable that contains the file or directory
    we're going to Test.
    Returns:
    None
    #>

    $fileordirectoryExists = Test-Path $fileordirectory

    if($fileordirectoryExists -eq $false){
    throw [System.IO.DirectoryNotFoundException] "Not Found: $fileordirectory"
    }
    }

    function promptUserwithQuestion
    { Param([Parameter(Mandatory=$true)]
    [string]$question)

    <#
    Prompts the user with a question accepts, trims and returns the answer
    Args:
    [string]$question - the variable that holds the question
    Returns:
    [string]$answer: the variable that holds the user provided answer.
    #>


    [string]$answer = Read-Host $question
    return $answer.Trim()
    }

    try{

    # Determine if the settings file exists
    $doesSettingsFileExist = Test-Path $settings

    # If the settings file doesn't exist, create one for the user, and store in the script location
    if($doesSettingsFileExist -eq $false){
    $userProvidedPath = promptUserwithQuestion -question "Full Path to Resume"
    verifyifparameterisempty -parametertoverify $userProvidedPath -parameterType "Resume Path"
    Add-Content -Path $settings -Value $userProvidedPath.Trim()
    }

    $pathToResume = Get-Content $settings

    $workBase = Split-Path -Parent $pathToResume
    $resumeCoverletterBase = Split-Path -Leaf $pathToResume
    $extention = $resumeCoverletterBase.Split(".")[1]

    <#
    Call the promptUserwithQuestion function and ask for the company name and job position.
    Afterward, verify that the user provided answers aren't blank
    #>
    $companyName = promptUserwithQuestion -question "Enter Company Name"
    verifyifparameterisempty -parametertoverify $companyName -parameterType "Company Name"

    $position = promptUserwithQuestion -question "Enter Job Position"
    verifyifparameterisempty -parametertoverify $position -parameterType "Position"

    # Combine the work base and company name for the folder name.
    $companyResumeandCoverLetterDirectory = Join-Path -Path $workBase -ChildPath $companyName

    $positionLoweredwithUnderscore = $position.ToLower().trim().replace(" ","_")

    $companyResumeandCoverLetterDirectorywithPosition = Join-Path -Path $companyResumeandCoverLetterDirectory -ChildPath $positionLoweredwithUnderscore

    $doesComanyDirectorywithPositionExists = Test-Path $companyResumeandCoverLetterDirectorywithPosition

    if($doesComanyDirectorywithPositionExists -eq $false){

    md $companyResumeandCoverLetterDirectorywithPosition

    Write-Output ([string]::Format("Copying {0} to {1}",$pathToResume, $companyResumeandCoverLetterDirectorywithPosition))
    Copy-Item -Path $pathToResume -Destination $companyResumeandCoverLetterDirectorywithPosition

    $completePathToresumeCoverletterwithPosition = Join-Path -Path $companyResumeandCoverLetterDirectorywithPosition -ChildPath $resumeCoverletterBase

    # Create a new name for our resume that includes the position name and extension.
    $resumeCoverletterwithPosition = [string]::Format("cover_letter_resume_{0}.{1}",$positionLoweredwithUnderscore,$extention)

    # Construct a path to the renamed cover letter and resume with extension.
    $renamedPathToresumeCoverletterwithPosition = Join-Path $companyResumeandCoverLetterDirectorywithPosition -ChildPath $resumeCoverletterwithPosition

    # Rename the base cover letter and resume.
    Write-Output([string]::Format("Renaming {0} to {1}",$completePathToresumeCoverletterwithPosition, $renamedPathToresumeCoverletterwithPosition))
    Rename-Item -Path $completePathToresumeCoverletterwithPosition -NewName $renamedPathToresumeCoverletterwithPosition

    # Open the resume and cover letter in LibreOffice
    Invoke-Item $renamedPathToresumeCoverletterwithPosition
    }

    }

    catch [System.ArgumentNullException]{
    Write-Output $PSItem.Exception.Message
    }

    catch [System.ArgumentException]{
    Write-Output $PSItem.Exception.Message
    }

    catch [System.IO.DirectoryNotFoundException]{
    Write-Output $PSItem.Exception.Message
    }

    catch [System.IO.IOException]{
    Write-Output $PSItem.Exception.Message
    }

    catch [System.Exception]{
    Write-Output $PSItem.Exception.Message
    }

    finally{
    exit
    }


    Explanation:



    When the user starts the script, it does the following:




    • Checks for the settings.txt file. If one isn't present, it creates one to store the location of the base resume and cover letter. When the user runs the script again, as long as settings.txt is present, it won't prompt for base location again. For example, R:Workcover_letter_resume_base.odt


    • The user is prompted for the company name and position, and the scripts lowers,trims,and strips the position and creates the directories. For example, if the company name was Microsoft and the position was Sofware Eng, the directory is R:WorkMicrosoftsoftware_eng. Using split-path it takes the location of the cover_letter_resume_base.odt in this case R:Work and creates the directories.


    • Finally it renames the document according to the user input, so R:WorkMicrosoftsoftware_engcover_letter_resume_software_eng.odt and opens it.










    share







    New contributor




    EmilyScott is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.







    $endgroup$















      0












      0








      0





      $begingroup$


      I'm in the middle of job searching and while doing so, I have to create a folder for the company and position, then move my base cover letter and resume to that folder and begin customizing the document.



      I've decided to automate the task with Powershell v4.



      <#
      Job Application Preparation
      The script asks the user for the company name and job then proceeds
      to create the company folder, move, and rename the base cover letter and resume.

      Version: 1.5
      #>

      # Resume Storage Location
      $workBase = [string]::Empty
      $resumeCoverletterBase = [string]::Empty
      $settings = "$PSScriptRootsettings.txt"

      function verifyifparameterisempty
      { Param( [Parameter(Mandatory=$true)]
      $parametertoverify,
      [Parameter(Mandatory=$true)]
      $parameterType
      )

      <#
      Determines if a string is null or contians whitespace.
      If it does, it will throw and display what was missing using the $parameterType
      Args:
      string: $parametertoverify - the string we're going to test
      string: $parameterType - what the string represents

      Return:
      None
      #>

      if([string]::IsNullOrWhiteSpace($parametertoverify)){
      throw [System.ArgumentNullException] "$parameterType"
      }
      }

      function determineIfFileorDirectoryExists
      { Param( [Parameter(Mandatory=$true)]
      [string]$fileordirectory)

      <#
      Determine if a File or Directory Exists. If the file or directory doesn't exists,
      it will throw an exception.
      Args:
      [string] $fileordirectory - the variable that contains the file or directory
      we're going to Test.
      Returns:
      None
      #>

      $fileordirectoryExists = Test-Path $fileordirectory

      if($fileordirectoryExists -eq $false){
      throw [System.IO.DirectoryNotFoundException] "Not Found: $fileordirectory"
      }
      }

      function promptUserwithQuestion
      { Param([Parameter(Mandatory=$true)]
      [string]$question)

      <#
      Prompts the user with a question accepts, trims and returns the answer
      Args:
      [string]$question - the variable that holds the question
      Returns:
      [string]$answer: the variable that holds the user provided answer.
      #>


      [string]$answer = Read-Host $question
      return $answer.Trim()
      }

      try{

      # Determine if the settings file exists
      $doesSettingsFileExist = Test-Path $settings

      # If the settings file doesn't exist, create one for the user, and store in the script location
      if($doesSettingsFileExist -eq $false){
      $userProvidedPath = promptUserwithQuestion -question "Full Path to Resume"
      verifyifparameterisempty -parametertoverify $userProvidedPath -parameterType "Resume Path"
      Add-Content -Path $settings -Value $userProvidedPath.Trim()
      }

      $pathToResume = Get-Content $settings

      $workBase = Split-Path -Parent $pathToResume
      $resumeCoverletterBase = Split-Path -Leaf $pathToResume
      $extention = $resumeCoverletterBase.Split(".")[1]

      <#
      Call the promptUserwithQuestion function and ask for the company name and job position.
      Afterward, verify that the user provided answers aren't blank
      #>
      $companyName = promptUserwithQuestion -question "Enter Company Name"
      verifyifparameterisempty -parametertoverify $companyName -parameterType "Company Name"

      $position = promptUserwithQuestion -question "Enter Job Position"
      verifyifparameterisempty -parametertoverify $position -parameterType "Position"

      # Combine the work base and company name for the folder name.
      $companyResumeandCoverLetterDirectory = Join-Path -Path $workBase -ChildPath $companyName

      $positionLoweredwithUnderscore = $position.ToLower().trim().replace(" ","_")

      $companyResumeandCoverLetterDirectorywithPosition = Join-Path -Path $companyResumeandCoverLetterDirectory -ChildPath $positionLoweredwithUnderscore

      $doesComanyDirectorywithPositionExists = Test-Path $companyResumeandCoverLetterDirectorywithPosition

      if($doesComanyDirectorywithPositionExists -eq $false){

      md $companyResumeandCoverLetterDirectorywithPosition

      Write-Output ([string]::Format("Copying {0} to {1}",$pathToResume, $companyResumeandCoverLetterDirectorywithPosition))
      Copy-Item -Path $pathToResume -Destination $companyResumeandCoverLetterDirectorywithPosition

      $completePathToresumeCoverletterwithPosition = Join-Path -Path $companyResumeandCoverLetterDirectorywithPosition -ChildPath $resumeCoverletterBase

      # Create a new name for our resume that includes the position name and extension.
      $resumeCoverletterwithPosition = [string]::Format("cover_letter_resume_{0}.{1}",$positionLoweredwithUnderscore,$extention)

      # Construct a path to the renamed cover letter and resume with extension.
      $renamedPathToresumeCoverletterwithPosition = Join-Path $companyResumeandCoverLetterDirectorywithPosition -ChildPath $resumeCoverletterwithPosition

      # Rename the base cover letter and resume.
      Write-Output([string]::Format("Renaming {0} to {1}",$completePathToresumeCoverletterwithPosition, $renamedPathToresumeCoverletterwithPosition))
      Rename-Item -Path $completePathToresumeCoverletterwithPosition -NewName $renamedPathToresumeCoverletterwithPosition

      # Open the resume and cover letter in LibreOffice
      Invoke-Item $renamedPathToresumeCoverletterwithPosition
      }

      }

      catch [System.ArgumentNullException]{
      Write-Output $PSItem.Exception.Message
      }

      catch [System.ArgumentException]{
      Write-Output $PSItem.Exception.Message
      }

      catch [System.IO.DirectoryNotFoundException]{
      Write-Output $PSItem.Exception.Message
      }

      catch [System.IO.IOException]{
      Write-Output $PSItem.Exception.Message
      }

      catch [System.Exception]{
      Write-Output $PSItem.Exception.Message
      }

      finally{
      exit
      }


      Explanation:



      When the user starts the script, it does the following:




      • Checks for the settings.txt file. If one isn't present, it creates one to store the location of the base resume and cover letter. When the user runs the script again, as long as settings.txt is present, it won't prompt for base location again. For example, R:Workcover_letter_resume_base.odt


      • The user is prompted for the company name and position, and the scripts lowers,trims,and strips the position and creates the directories. For example, if the company name was Microsoft and the position was Sofware Eng, the directory is R:WorkMicrosoftsoftware_eng. Using split-path it takes the location of the cover_letter_resume_base.odt in this case R:Work and creates the directories.


      • Finally it renames the document according to the user input, so R:WorkMicrosoftsoftware_engcover_letter_resume_software_eng.odt and opens it.










      share







      New contributor




      EmilyScott is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.







      $endgroup$




      I'm in the middle of job searching and while doing so, I have to create a folder for the company and position, then move my base cover letter and resume to that folder and begin customizing the document.



      I've decided to automate the task with Powershell v4.



      <#
      Job Application Preparation
      The script asks the user for the company name and job then proceeds
      to create the company folder, move, and rename the base cover letter and resume.

      Version: 1.5
      #>

      # Resume Storage Location
      $workBase = [string]::Empty
      $resumeCoverletterBase = [string]::Empty
      $settings = "$PSScriptRootsettings.txt"

      function verifyifparameterisempty
      { Param( [Parameter(Mandatory=$true)]
      $parametertoverify,
      [Parameter(Mandatory=$true)]
      $parameterType
      )

      <#
      Determines if a string is null or contians whitespace.
      If it does, it will throw and display what was missing using the $parameterType
      Args:
      string: $parametertoverify - the string we're going to test
      string: $parameterType - what the string represents

      Return:
      None
      #>

      if([string]::IsNullOrWhiteSpace($parametertoverify)){
      throw [System.ArgumentNullException] "$parameterType"
      }
      }

      function determineIfFileorDirectoryExists
      { Param( [Parameter(Mandatory=$true)]
      [string]$fileordirectory)

      <#
      Determine if a File or Directory Exists. If the file or directory doesn't exists,
      it will throw an exception.
      Args:
      [string] $fileordirectory - the variable that contains the file or directory
      we're going to Test.
      Returns:
      None
      #>

      $fileordirectoryExists = Test-Path $fileordirectory

      if($fileordirectoryExists -eq $false){
      throw [System.IO.DirectoryNotFoundException] "Not Found: $fileordirectory"
      }
      }

      function promptUserwithQuestion
      { Param([Parameter(Mandatory=$true)]
      [string]$question)

      <#
      Prompts the user with a question accepts, trims and returns the answer
      Args:
      [string]$question - the variable that holds the question
      Returns:
      [string]$answer: the variable that holds the user provided answer.
      #>


      [string]$answer = Read-Host $question
      return $answer.Trim()
      }

      try{

      # Determine if the settings file exists
      $doesSettingsFileExist = Test-Path $settings

      # If the settings file doesn't exist, create one for the user, and store in the script location
      if($doesSettingsFileExist -eq $false){
      $userProvidedPath = promptUserwithQuestion -question "Full Path to Resume"
      verifyifparameterisempty -parametertoverify $userProvidedPath -parameterType "Resume Path"
      Add-Content -Path $settings -Value $userProvidedPath.Trim()
      }

      $pathToResume = Get-Content $settings

      $workBase = Split-Path -Parent $pathToResume
      $resumeCoverletterBase = Split-Path -Leaf $pathToResume
      $extention = $resumeCoverletterBase.Split(".")[1]

      <#
      Call the promptUserwithQuestion function and ask for the company name and job position.
      Afterward, verify that the user provided answers aren't blank
      #>
      $companyName = promptUserwithQuestion -question "Enter Company Name"
      verifyifparameterisempty -parametertoverify $companyName -parameterType "Company Name"

      $position = promptUserwithQuestion -question "Enter Job Position"
      verifyifparameterisempty -parametertoverify $position -parameterType "Position"

      # Combine the work base and company name for the folder name.
      $companyResumeandCoverLetterDirectory = Join-Path -Path $workBase -ChildPath $companyName

      $positionLoweredwithUnderscore = $position.ToLower().trim().replace(" ","_")

      $companyResumeandCoverLetterDirectorywithPosition = Join-Path -Path $companyResumeandCoverLetterDirectory -ChildPath $positionLoweredwithUnderscore

      $doesComanyDirectorywithPositionExists = Test-Path $companyResumeandCoverLetterDirectorywithPosition

      if($doesComanyDirectorywithPositionExists -eq $false){

      md $companyResumeandCoverLetterDirectorywithPosition

      Write-Output ([string]::Format("Copying {0} to {1}",$pathToResume, $companyResumeandCoverLetterDirectorywithPosition))
      Copy-Item -Path $pathToResume -Destination $companyResumeandCoverLetterDirectorywithPosition

      $completePathToresumeCoverletterwithPosition = Join-Path -Path $companyResumeandCoverLetterDirectorywithPosition -ChildPath $resumeCoverletterBase

      # Create a new name for our resume that includes the position name and extension.
      $resumeCoverletterwithPosition = [string]::Format("cover_letter_resume_{0}.{1}",$positionLoweredwithUnderscore,$extention)

      # Construct a path to the renamed cover letter and resume with extension.
      $renamedPathToresumeCoverletterwithPosition = Join-Path $companyResumeandCoverLetterDirectorywithPosition -ChildPath $resumeCoverletterwithPosition

      # Rename the base cover letter and resume.
      Write-Output([string]::Format("Renaming {0} to {1}",$completePathToresumeCoverletterwithPosition, $renamedPathToresumeCoverletterwithPosition))
      Rename-Item -Path $completePathToresumeCoverletterwithPosition -NewName $renamedPathToresumeCoverletterwithPosition

      # Open the resume and cover letter in LibreOffice
      Invoke-Item $renamedPathToresumeCoverletterwithPosition
      }

      }

      catch [System.ArgumentNullException]{
      Write-Output $PSItem.Exception.Message
      }

      catch [System.ArgumentException]{
      Write-Output $PSItem.Exception.Message
      }

      catch [System.IO.DirectoryNotFoundException]{
      Write-Output $PSItem.Exception.Message
      }

      catch [System.IO.IOException]{
      Write-Output $PSItem.Exception.Message
      }

      catch [System.Exception]{
      Write-Output $PSItem.Exception.Message
      }

      finally{
      exit
      }


      Explanation:



      When the user starts the script, it does the following:




      • Checks for the settings.txt file. If one isn't present, it creates one to store the location of the base resume and cover letter. When the user runs the script again, as long as settings.txt is present, it won't prompt for base location again. For example, R:Workcover_letter_resume_base.odt


      • The user is prompted for the company name and position, and the scripts lowers,trims,and strips the position and creates the directories. For example, if the company name was Microsoft and the position was Sofware Eng, the directory is R:WorkMicrosoftsoftware_eng. Using split-path it takes the location of the cover_letter_resume_base.odt in this case R:Work and creates the directories.


      • Finally it renames the document according to the user input, so R:WorkMicrosoftsoftware_engcover_letter_resume_software_eng.odt and opens it.








      powershell





      share







      New contributor




      EmilyScott is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      EmilyScott is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      EmilyScott is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 7 mins ago









      EmilyScottEmilyScott

      13




      13




      New contributor




      EmilyScott is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      EmilyScott is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      EmilyScott is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "196"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          EmilyScott is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f212505%2fusing-powershell-to-automate-creating-company-directory-and-renaming-cover-lette%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          EmilyScott is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          EmilyScott is a new contributor. Be nice, and check out our Code of Conduct.













          EmilyScott is a new contributor. Be nice, and check out our Code of Conduct.












          EmilyScott is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Code Review Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f212505%2fusing-powershell-to-automate-creating-company-directory-and-renaming-cover-lette%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Сан-Квентин

          Алькесар

          Josef Freinademetz