In windows powershell, I am trying to store a move command in a string and then execute it. Can someone tell me why this doesn't work?
PS C:\Temp\> dir
Directory: Microsoft.PowerShell.Core\FileSystem::C:\Temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 8/14/2009 8:05 PM 2596 sa.csproj
-a--- 8/15/2009 10:42 AM 0 test.ps1
PS C:\Temp> $str = "mv sa.csproj sb.csproj"
PS C:\Temp> &$str
The term 'mv sa.csproj sb.csproj' is not recognized as a cmdlet, function, operable program, or script file. Verify the
term and try again.
At line:1 char:2
+ &$ <<<< str
PS C:\Temp>
I get this error when storing any command with arguments. How do I overcome this limitation?