cjtucker1976
Technical User
In win2oo3 i had a batch file that renamed a file and added the date.
ren C:\test.txt test_%date:~-4,4%%date:~-10,2%%date:~-7,2%.txt
I get an error in Windows 2012
Rename-Item : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'NewName'. Specified
method is not supported.
At line:1 char:17
+ ren C:\test.txt test_%date:~-4,4%%date:~-10,2%%date:~-7,2%.txt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: ) [Rename-Item], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.RenameItemCommand
any suggestions
ren C:\test.txt test_%date:~-4,4%%date:~-10,2%%date:~-7,2%.txt
I get an error in Windows 2012
Rename-Item : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'NewName'. Specified
method is not supported.
At line:1 char:17
+ ren C:\test.txt test_%date:~-4,4%%date:~-10,2%%date:~-7,2%.txt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: ) [Rename-Item], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.RenameItemCommand
any suggestions