Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Powershell Newbie

Reply
 
Old 04-09-2009   #1 (permalink)


x64
 
 

Powershell Newbie

Hi,

I'm now to this forum, hi to everyone. I normally use command prompt and have now decided to use powershell. I have the following script:-

Set-Location "C:\Documents and Settings\Admin\Desktop\TEST"
$yesterday=(get-date (get-date).AddDays(-1) -uformat %Y%m%d)
rename-item 20090408_04.LOG "$yesterday.a04"

Fisrtly, I cannot get the script to run, I've set the file *.ps1 to open with powershell, I get a flash of red writing and it disappears too quickly. Therefore I have no idea what the error is.

The Execution Policy is set to unrestricted.

Secondly, the files I'm trying to rename change on a daily basis (today's date)_04.LOG, (today's date)_05.LOG, (today's date)_06.LOG etc to $yesterday.a04, $yesterday.a05, $yesterday.a06 etc. How would I do this???

I know, this is my first time, I'm asking loads of questions....

Thanks in advance.

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
powershell newbie help PowerShell
Newbie: WMI and Powershell PowerShell
Newbie to Powershell PowerShell
Newbie to PowerShell PowerShell
newbie - How to use FTP in powershell PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46