I created a script file in this path 'D:\Scripts\temp\foo bar\script.ps1'
with a conetnt of:
for($i=0;$i -lt $args.length;$i++){
"Arg $i is <" +$args[$i]+">"
}
Then I executed this command in start>run box:
powershell.exe -noexit -noprofile & 'D:\Scripts\temp\foo bar\script.ps1'
'C:\Folder Name\Staging\' 'C:\Folder Name\Staging \Inbound\' .txt move 100 N
The output shows that all args are in place, do you get similar results?
Arg 0 is <C:\Folder Name\Staging\>
Arg 1 is <C:\Folder Name\Staging \Inbound\>
Arg 2 is <.txt>
Arg 3 is <move>
Arg 4 is <100>
Arg 5 is <N>
---
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar:
http://tinyurl.com/PSToolbar
> Thanks for your reply.
>
> It doesn't appear that the script is executing at all: no output is
> displayed and the actions (e.g. Copy-Item) are not performed. The
> result is simply that the Powershell console is enabled within the
> cmd.exe shell. In some cases, depending on how the arguments are
> wrapped with quotations in the call, the script file itself is loaded
> into memory - in edit mode within notepad.
>
> Dumping the args array to stdout when running the script within the
> Powershell ISE shows all of the args are getting through ok. An
> alternative would be to create and use an ini-type file to store the
> arguments but using commandline parameters scales better.
>