Syntax - Running a PowerShell script that has spaces in path.

Author Message
TomRiddle

  • Total Posts : 620
  • Scores: 12
  • Reward points : 0
  • Joined: 2/7/2008
  • Location: Australia
  • Status: offline
Syntax - Running a PowerShell script that has spaces in path. Wednesday, July 21, 2010 1:28 AM (permalink)
0
PS C:\> PowerShell "& 'C:\script with spaces.ps1'"
 
C:\> PowerShell –noexit "& 'C:\script with spaces.ps1'"
 
PS C:\> Invoke-Expression "& 'C:\script with spaces.ps1'"
-join([int[]][char[]]'Ut|jwXmjqq%Wzqjx'|%{[char]($_-5)})
 
#1
    ebgreen

    • Total Posts : 8227
    • Scores: 98
    • Reward points : 0
    • Joined: 7/12/2005
    • Status: offline
    Re:Syntax - Running a PowerShell script that has spaces in path. Wednesday, July 21, 2010 1:39 AM (permalink)
    0
    Don't forget that you can use dot sourcing to execute the script in the current scope as well:

    PS C:\> . 'C:\script with spaces.ps1'
    "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
    Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
    http://www.visualbasicscript.com/m_47117/tm.htm
     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9