반응형

PowerShell 26

PowerShell에서 사용되는 GetType, 변수 간 차이

PowerShell에서 사용되는 GetType, 변수 간 차이 변수 간의 차이점은 무엇입니까?$a그리고.$b? $a = (Get-Date).DayOfWeek $b = Get-Date | Select-Object DayOfWeek 확인하려고 했다 $a.GetType $b.GetType MemberType : Method OverloadDefinitions : {type GetType()} TypeNameOfValue : System.Management.Automation.PSMethod Value : type GetType() Name : GetType IsInstance : True MemberType : Method OverloadDefinitions : {type GetType()} TypeNameO..

sourcecode 2023.04.08

PowerShell 탭 완성을 Bash와 동일하게 하는 방법

PowerShell 탭 완성을 Bash와 동일하게 하는 방법 현재 디렉터리에 다음 파일이 있다고 가정합니다. buildBar.bat buildFoo.bat buildHouse.bat 명령 프롬프트에서 다음을 입력합니다../bu를 클릭합니다. Bash에서는 다음과 같이 확장됩니다../build PowerShell에서는 다음과 같이 확장됩니다../buildBar.bat-- 목록의 첫 번째 항목입니다. Cmd의 동작은 PowerShell과 동일합니다. 저는 Bash 동작을 선호합니다. PowerShell을 Bash처럼 동작시킬 수 있는 방법이 있습니까?PowerShell의 새로운 버전에는 PSReadline이 포함되어 있으며, 이 기능을 사용할 수 있습니다. Set-PSReadlineKeyHandler -Ke..

sourcecode 2023.04.08

보안 문자열을 일반 텍스트로 변환

보안 문자열을 일반 텍스트로 변환 PowerShell에서 일하고 있으며 사용자가 입력한 암호를 일반 텍스트로 변환하는 코드를 가지고 있습니다. $SecurePassword = Read-Host -AsSecureString "Enter password" | convertfrom-securestring | out-file C:\Users\tmarsh\Documents\securePassword.txt 원래대로 되돌리기 위해 여러 가지 방법을 시도해 보았지만, 어느 것도 제대로 작동하지 않는 것 같아요.최근에 다음과 같이 시도했습니다. $PlainPassword = Get-Content C:\Users\tmarsh\Documents\securePassword.txt #convert the SecureStrin..

sourcecode 2023.04.08

PowerShell을 사용하여 텍스트 파일을 분할하려면 어떻게 해야 합니까?

PowerShell을 사용하여 텍스트 파일을 분할하려면 어떻게 해야 합니까? 큰(500MB) 텍스트 파일(log4net 예외 파일)을 5MB 파일 100개처럼 관리하기 쉬운 청크로 분할해야 합니다. PowerShell을 위한 산책이 될 것 같습니다.어떻게 해야 하죠?기존 답변 중 일부에 대한 경고 메시지입니다. 파일이 매우 크면 실행 속도가 매우 느려집니다.1.6GB 로그파일은 몇 시간 후에 포기했습니다.다음 날 업무에 복귀할 때까지 종료되지 않는다는 것을 깨달았습니다. 두 가지 문제: Add-Content 호출은 소스 파일 내의 모든 행에 대해 현재 수신인 파일을 열고 검색한 후 닫습니다.매번 소스 파일을 조금씩 읽고 새로운 행을 찾는 것도 느려지지만, 제 생각에는 Add-Content가 주범인 것 같..

sourcecode 2023.04.08

PowerShell에서 어셈블리를 로드하는 방법

PowerShell에서 어셈블리를 로드하는 방법 다음 PowerShell 코드 #Get a server object which corresponds to the default instance $srv = New-Object -TypeName Microsoft.SqlServer.Management.SMO.Server ... rest of the script ... 다음 오류 메시지를 표시합니다. New-Object : Cannot find type [Microsoft.SqlServer.Management.SMO.Server]: make sure the assembly containing this type is loaded. At C:\Users\sortelyn\ ... \tools\sql_express_b..

sourcecode 2023.04.08
반응형