locked
How to create a Folder under a Folder Tree RRS feed

  • Question

  • Hi Guys,

    I came across the  cmdlet to create a folder under .\Devicecollection

    New-Item -Name TEST2 -Path .\DeviceCollection

    But my requirement is to create a folder under below path - under a folder tree

    \Device Collections\Operational Collections Global\Software Distribution Global\SD Global-Production Applications

     tried below code

    New-Item -Name TEST2 -Path .\DeviceCollection\Operational Collections Global\Software Distribution Global\SD Global-Production Applications

    but got the error as below

    New-Item : A positional parameter cannot be found that accepts argument 'Collections'.

    please help me


    Sunish Surendran.k




    Monday, October 10, 2016 4:20 PM

Answers

  • Dear Sir,

    Use below with single quotes:

    New-Item -Name TEST2 -Path '.\DeviceCollection\Operational Collections Global\Software Distribution Global\SD Global-Production Applications'

    Best regards

    Frank


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Tuesday, October 11, 2016 5:56 AM
  • Your path has a space in which means it can't be parsed correctly. Thus, you need to surround the path with single quotes (or double quotes although single quotes are generally preferred unless you need variable replacement).

    Jason | http://blog.configmgrftw.com | @jasonsandys

    • Proposed as answer by Frank Dong Tuesday, October 11, 2016 5:54 AM
    • Marked as answer by Sunish Surendran k Tuesday, October 11, 2016 12:54 PM
    Monday, October 10, 2016 4:51 PM

All replies

  • Your path has a space in which means it can't be parsed correctly. Thus, you need to surround the path with single quotes (or double quotes although single quotes are generally preferred unless you need variable replacement).

    Jason | http://blog.configmgrftw.com | @jasonsandys

    • Proposed as answer by Frank Dong Tuesday, October 11, 2016 5:54 AM
    • Marked as answer by Sunish Surendran k Tuesday, October 11, 2016 12:54 PM
    Monday, October 10, 2016 4:51 PM
  • Dear Sir,

    Use below with single quotes:

    New-Item -Name TEST2 -Path '.\DeviceCollection\Operational Collections Global\Software Distribution Global\SD Global-Production Applications'

    Best regards

    Frank


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Tuesday, October 11, 2016 5:56 AM
  • Thanks Frank :)

    Sunish Surendran.k

    Tuesday, October 11, 2016 12:53 PM