Saved Bookmarks
| 1. |
Solve : Append month/year names to the end of a file? |
|
Answer» Quote from: ghostdog74 on May 23, 2007, 10:46:47 AM if you have XP you can use powershell. its easier. You have to download it, and as to whether it's easier, that's a MATTER of opinion. Object oriented shell programming isn't everybody's cup of tea, ESPECIALLY if they are just starting out. Do you NEED this loaded on the server as well as the workstation?Quote from: contrex on May 23, 2007, 10:49:44 AM Quote from: ghostdog74 on May 23, 2007, 10:46:47 AMSo what's wrong with downloading it , esp it is a m$ tool? by the way, It will be included in the OS in future (win2008).if you have XP you can use powershell. its easier. Quote Object oriented shell programming isn't everybody's cup of tealike you said, its a matter of opinion, its up to whoever to use his computer to the fullest... Quote from: crosscut2020 on May 23, 2007, 10:56:53 AM Do you need this loaded on the server as well as the workstation?no need, you install it on the machine you want to run the script from.Quote from: crosscut2020 on May 23, 2007, 10:56:53 AM Do you need this loaded on the server as well as the workstation?You would need PowerShell and all of PowerShell's dependencies installed on any computer that will run a PowerShell script. So if just one computer will run it, it just needs to be installed on one computer. If the script will be run on all computers in an organization, then PowerShell would need to be installed on all of those computers. PowerShell does have a lot more power than the standard CMD shell, but for copying a file to a new name with an embedded timestamp ... I personally think batch is just as easy. And it can be done in one line. For my U.S. English FORMATTED date, the code to duplicate the requested Quote copy fileName.csv folderA\%yr%%mth%%dy%fileName.csvis: Code: [SELECT]copy fileName.csv folderA\%date:~-4%%date:~-10,2%%date:~-7,2%fileName.csvAnd to do it in PowerShell, I would personally do it in one line also, like: Code: [Select]cp fileName.csv "folderA\$(get-date -uformat +%Y%m%d)fileName.csv" PowerShell and many other scripting languages (like Perl, Python, etc.) are great tools, but I think cmd shell batch is so much more convenient because it is already there and working in Windows. No installing, no dependencies, no compiling. Several years down the road, when most computers have PowerShell built into Windows, I will probably use it a lot more. Right now, I just use it for things that the cmd shell can't do, and on my own computer where I don't have to worry about compatibility. Just my two cents. |
|