building a folder in current directory

Welcome Forums General PowerShell Q&A building a folder in current directory

This topic contains 2 replies, has 2 voices, and was last updated by

ira
 
Participant
1 year, 6 months ago.

  • Author
    Posts
  • #71468
    ira

    Participant
    Points: 0
    Rank: Member

    Hello all. This is my first time on this site and my first crack at power shell. I am trying to build a script where i can right click anywhere and from the drop-down context menu i can pick my powershell script and it will execute it. I have that registry tweak figure out as i built this same thing as a batch file already. Now i would like to build it in powershell. What i am trying to do is build some folders from user input in the current directory and copy a file and that is where i get stumped. I know the following is very elementary but we all have to start somewhere. Can anyone provide and assistance please? thx.

    $curd= get-location
    $pnum=read-host "enter number"
    $psuf=read-host "enter suffix"
    $pnam=read-host "enter name"
    new-item -path $curd -name $pnam -type dir
    copy-item "C:\Project\test.dotx" "$curd\$pnam\$pnum-$psuf.dotx"

  • #71480

    Participant
    Points: 1
    Rank: Member

    $curd= get-location
    $pnum=read-host "enter number"
    $psuf=read-host "enter suffix"
    $pnam=read-host "enter name"
    new-item -path $curd -name $pnam -type dir
    copy-item d:\try\test.txt -Destination $curd\$pnam\$pnum-$psuf.dotx

    • #71546
      ira

      Participant
      Points: 0
      Rank: Member

      worked great... thanks Chris

The topic ‘building a folder in current directory’ is closed to new replies.