2013-10-19 3 views
1

xp, powershell 및 예약 된 tasks.I 같은 간단한 문제가 powershell 2.0 및 예약 된 작업을 win7 사용하는 작업 스크립트가 있습니다. Windows XP에서 동일한 작업을 수행 할 수 있습니다. . 필요한 프레임 워크를 설치했는데 스크립트는 winxp에서 준비되었지만 예약 된 작업을 수행 할 수는 없었습니다. 전 win7에서 필요한 일정 잡기 작업을 자동으로 추가하고 일정을 계획하는 방법을 배우기 위해 win7에서 사용했습니다. winxp에서도 동일합니다. XP에서 예약 작업으로 Powershell 2.0 스크립트

schtasks /delete /tn "PowerIdle" /F 
schtasks /delete /tn "PowerIdleKill" /F 
schtasks /delete /tn "PowerIdleSleep" /F 
schtasks /create /tn "PowerIdle" /tr "powershell -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass -File \"%~dp0power_script.ps1\"" /sc minute /mo 30 /st 00:00 
schtasks /run /tn "PowerIdle" 

기본적으로 내가 동일 (WIN7)에서 승리 XP 예정 tasks.Powershell 스크립트가 내 컴퓨터에서 아래의 디렉토리에 있습니다 위의 설치가 필요합니다.

C : \ 문서 및 설정 \ 관리자 \ 바탕 화면 \ PowerIdleV3 \ 미리

감사 power_script.ps1!

편집 : 나는 해결책을 발견 :

1) 사용자 지정 프로그램을 추가를 선택 C : \ WINDOWS \ system32를 \의 WindowsPowerShell 버전 1.0 \의 powershell.exe를 \

2) 다음 아래 C로 프로그램 라인을 변경 : \ WINDOWS \ system32를 \의 WindowsPowerShell V1.0 \ powershell.exe를 -NonInteractive -WindowStyle 숨겨진 -ExecutionPolicy 바이 패스 - 파일 C : \ \ PowerIdleV3 \ power_script.ps1

+0

4 몇 년 후, soluti를 추가해 주셔서 감사합니다. 에. – khaverim

답변

0

내가 예약 *이 .ps1 파일 C를 실행하려면이 구문을 사용하고 있습니다. \ WINDOWS \ system32를 \의 WindowsPowerShell은 V1.0 \ \는 powershell.exe를 - 명령 \ automatedemail1.ps1

AUTOMATEDEMAIL1.PS1 
$email="[email protected]?.com" 
$subject="Lunch" 
$body="back in an hour $(get-date)” 

Send-MailMessage -from $email -to $email -subject $subject -body $body -smtpServer esdsmtp –bodyashtml 

이 구문을 실행 회전에 PS 작업을 "C : \ 문서 및 설정 \ jyoung \ testmail1.bat"실행 박쥐 파일.

TESTMAIL1.BAT 하여 powershell.exe - 명령을 \ automatedemail1.ps1

AUTOMATEDEMAIL1.PS1 
$email="[email protected]?.com" 
$subject="Lunch" 
$body="back in an hour $(get-date)” 

Send-MailMessage -from $email -to $email -subject $subject -body $body -smtpServer  ???smtp –bodyashtml 
관련 문제