building a folder in current directory

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of ira ira 1 month ago.

  • Author
    Posts
  • #71468
    Profile photo of ira
    ira
    Participant

    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
    Profile photo of Chris Bakker
    Chris Bakker
    Participant

    $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
      Profile photo of ira
      ira
      Participant

      worked great... thanks Chris

You must be logged in to reply to this topic.