Задайте вопросЗадайте вопрос
 

Отвеченоreplace text in file using wildcards

Ответы

  • 24 июня 2009 г. 18:41Marco ShawMVP, МодераторМедали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     ОтвеченоС кодом
    Check this out:
    $today=get-date -format yyyMMdd
    
    $today
    
    $yesterday=(get-date).adddays(-1)|%{
      if($_.month -lt 10){$month=[string]0+$_.month}else{$month=$_.month}
      if($_.day -lt 10){$day=[string]0+$_.day}else{$day=$_.day}
      [string]$_.year+[string]$month+[string]$day
    }
    
    $yesterday
    
    "$yesterday".replace($yesterday,$today)
    
    Using the format you're looking for to calculate yesterday is a PAIN!  Maybe there's an easier though.

    That should help you out...
    • Помечено в качестве ответаmnemonicator 25 июня 2009 г. 6:31
    •  

Все ответы