시간에 따라 내 PC에서 소셜 미디어를 차단하고 싶습니다. 오전 9시 이후에 차단하고 오전 11시 이후에 차단 해제 (자녀 보호과 같이) 다음을 시도했지만 실패했습니다. Windows에서 소셜 미디어를 차단하는 방법
는Unblock.bat
파일을
@echo off
(Get-Content C:\Windows\System32\drivers\etc\hosts) | ForEach-Object { $_ -replace "127.0.0.1 facebook.com", "#127.0.0.1 facebook.com" } | Set-Content C:\Windows\System32\drivers\etc\hosts
을 만든 block.bat
파일
@echo off
(Get-Content C:\Windows\System32\drivers\etc\hosts) | ForEach-Object { $_ -replace "#127.0.0.1 facebook.com", "127.0.0.1 facebook.com" } | Set-Content C:\Windows\System32\drivers\etc\hosts
을 만들고 작업 스케줄러 이러한 2 박쥐 파일을 추가했습니다. 차단은 오전 11시에 실행되고 오후 9시에 잠금 해제됩니다.
Set-Content : The input object cannot be bound because it did not contain the information required to bind all mandatory parameters: Path At line:1 char:140 + ... e "#127.0.0.1 facebook.com", "127.0.0.1 facebook.com" } | Set-Content + ~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (# Copyright (c)...Microsoft Corp.:String) [Set-Content], ParameterBindingException + FullyQualifiedErrorId : InputObjectMissingMandatory,Microsoft.PowerShell.Commands.SetContentCommand
을 수동으로 박쥐 파일을 실행하면 아무것도하지 않는다 :
나는 PowerShell에서이 오류를 얻고있다.
안녕하세요, 무엇을 작동하지 않는 이유는 무엇입니까? 박쥐 파일? 예정된 작업? 이 질문을 포함하도록 질문을 편집하십시오. – sodawillow
실패한 것이 정확히 무엇인지 자세히 설명해주십시오. –
powershell에서 테스트 스크립트 실행하기'(Get-Content test.txt) | ForEach-Object {$ _ -replace "from", "to"} | Set-Content test.txt'이 코드는 완벽하게 작동합니다. 하지만 내가 경로를 변경하고 박쥐에서 실행되면 그것은 작동하지 않습니다. – Nithee