Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Add YYYYMMDD_xyz_ftp in front of the file name using PowerShell

$
0
0

Hi All,

I am working on a PowerShell script to generate a dat file. I need to change the format of this file as follows:

Original File Name: eagle.dat

Required File Name: YYYYMMDD_CA_eagle.dat

I know that we can do this very easily from Windows Cmd like below. I have written this massive PowerShell script which I do not want to be wasted just because of this last step.

rename eagle.dat %date:~-4,4%%date:~-10,2%%date:~-7,2%_CA_eagle.dat

Thank you in advance for your reply.

Ben


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>