top of page


Public·10 members

Tst (4).txt

The command uses the Get-ChildItem cmdlet to get all of the child items in the current directory(represented by the dot (.)) and its subdirectories that have a *.txt file name extension. Ituses the Recurse parameter to make the retrieval recursive and the Include parameter tolimit the retrieval to *.txt files.

tst (4).txt

In Windows PowerShell 2.0, when using the Recurse parameter of the Get-ChildItem cmdlet, thevalue of the Path parameter must be a container. Use the Include parameter to specify the*.txt file name extension filter(Get-ChildItem -Path .\* -Include *.txt -Recurse Move-Item -Destination C:\TextFiles).

Specifies, as a string array, an item or items that this cmdlet excludes in the operation. The valueof this parameter qualifies the Path parameter. Enter a path element or pattern, such as*.txt. Wildcard characters are permitted. The Exclude parameter is effective only when thecommand includes the contents of an item, such as C:\Windows\*, where the wildcard characterspecifies the contents of the C:\Windows directory.

Specifies, as a string array, an item or items that this cmdlet includes in the operation. The valueof this parameter qualifies the Path parameter. Enter a path element or pattern, such as*.txt. Wildcard characters are permitted. The Include parameter is effective only when thecommand includes the contents of an item, such as C:\Windows\*, where the wildcard characterspecifies the contents of the C:\Windows directory.

A robots.txt file tells search engine crawlers which URLs the crawler can access on your site. This is used mainly to avoid overloading your site with requests; it is not a mechanism for keeping a web page out of Google. To keep a web page out of Google, block indexing with noindex or password-protect the page.

If you use a CMS, such as Wix or Blogger, you might not need to (or be able to) edit your robots.txt file directly. Instead, your CMS might expose a search settings page or some other mechanism to tell search engines whether or not to crawl your page.

You can use a robots.txt file for web pages (HTML, PDF, or other non-media formats that Google can read), to manage crawling traffic if you think your server will be overwhelmed by requests from Google's crawler, or to avoid crawling unimportant or similar pages on your site.

If your web page is blocked with a robots.txt file, its URL can still appear in search results, but the search result will not have a description. Image files, video files, PDFs, and other non-HTML files will be excluded. If you see this search result for your page and want to fix it, remove the robots.txt entry blocking the page. If you want to hide the page completely from Search, use another method.

Use a robots.txt file to manage crawl traffic, and also to prevent image, video, and audio files from appearing in Google search results. This won't prevent other pages or users from linking to your image, video, or audio file.

Before you create or edit a robots.txt file, you should know the limits of this URL blocking method. Depending on your goals and situation, you might want to consider other mechanisms to ensure your URLs are not findable on the web.

Hmm, "shell script only". Well, with that in mind, perhaps you could pre-grep "$LOC/check.txt" and/or "$LOC/temp.txt" so that you could use the 'already grepped' output instead of grepping in the loop.

Having posted this, I am actually not convinced that your performance issues stem from just these two for loops invoking awk/sed/grep. Could you output the first ten lines of your $SCRIPT_LOC/running_status.txt when your script runs for an hour or so?

MATLAB can read and write numeric and nonnumeric data from delimited and formatted text files, including .csv and .txt files. Text files often contain a mix of numeric and text data as well as variable and row names. You can represent this data in MATLAB as tables, timetables, matrices, cell arrays, or string arrays.

Import tabular data from a text file into a matrix using readmatrix. For example, import the data from the sample file basic_matrix.txt into a matrix.M = readmatrix('basic_matrix.txt')M = 54 6 8 3 1 5 4 7 3 1 6 7 10 4 2 8 2 2 7 5 9

Import lines of plain text in a text file into string arrays using readlines. For example, create a string array from the sample text file, badpoem.txt. Since the text file has four lines of plain text, the function creates a 4-by-1 string array.lines = readlines("badpoem.txt")lines = 4x1 string "Oranges and lemons," "Pineapples and tea." "Orangutans and monkeys," "Dragonflys or fleas."

The robots.txt Tester tool shows you whether your robots.txt file blocks Google web crawlers from specific URLs on your site. For example, you can use this tool to test whether the Googlebot-Image crawler can crawl the URL of an image you wish to block from Google Image Search.

Your script worked great, maybe too great! Now they have asked me to add columns for the computer's Primary and Secondary DNS and WINS servers.I looked up the properties of Win32_NetworkAdapterConfiguration and found WINSPrimaryServer and WINSSecondaryServer. I tried to add them to your script as follows (I bolded the parts I added). When I run the script it locks up. When I end it, nothing is written to the log file except the column headers (probably the only thing I managed to get correct LOL).'----------------------------------------------------------------------------------------------------------------------------'Script Name : PingHostNames.vbs'Author : Matthew Beattie'Created : 23/08/09'Description : This script reads a text file from the scripts working directory named "ComputerNames.txt" containing a list' : of computer names to enumerate the IP and MAC addresses. For each computer name read from the text file the' : script attempts to verify the network connectivity of the remote host and enumerate it's IP configuration.' : All results are logged to the scripts working directory in either a .log or .err file.'----------------------------------------------------------------------------------------------------------------------------'Initialization Section'----------------------------------------------------------------------------------------------------------------------------Option ExplicitConst ForReading = 1Const ForWriting = 2Const ForAppending = 8Dim objFSO, scriptBaseName, scriptPath, scriptLogPathOn Error Resume Next Set objFSO = CreateObject("Scripting.FileSystemObject") scriptBaseName = objFSO.GetBaseName(Wscript.ScriptFullName) scriptPath = objFSO.GetFile(Wscript.ScriptFullName).ParentFolder.Path scriptLogPath = scriptPath & "\" & scriptBaseName If Err.Number 0 Then Wscript.Quit End IfOn Error Goto 0'----------------------------------------------------------------------------------------------------------------------------'Main Processing Section'----------------------------------------------------------------------------------------------------------------------------On Error Resume Next PromptScriptStart ProcessScript If Err.Number 0 Then MsgBox "An Unexpected Error Occurred", vbCritical, scriptBaseName Wscript.Quit End If PromptScriptEndOn Error Goto 0'----------------------------------------------------------------------------------------------------------------------------'Functions Processing Section'----------------------------------------------------------------------------------------------------------------------------'Name : ProcessScript -> Primary Function that controls all other script processing.'Parameters : None ->'Return : None ->'----------------------------------------------------------------------------------------------------------------------------Function ProcessScript Dim hostNames, ipAddress, macAddress, i '------------------------------------------------------------------------------------------------------------------------- 'Ensure the "ComputerNames.txt" file exists in the scripts working directory. '------------------------------------------------------------------------------------------------------------------------- If Not objFSO.FileExists(scriptPath & "\ComputerNames.txt") Then MsgBox DQ(scriptPath & "\ComputerNames.txt" & " does not exist!"), vbCritical, scriptBaseName Exit Function End If '------------------------------------------------------------------------------------------------------------------------- 'Read the list of computer names from the "ComputerNames.txt" file from the scripts workinging directory into an array. '------------------------------------------------------------------------------------------------------------------------- If Not GetScriptInput(hostNames, scriptPath & "\ComputerNames.txt") Then Exit Function End If '------------------------------------------------------------------------------------------------------------------------- 'Loop through the array of computer names and attempt to enumerate the IP configuration of each computer. '------------------------------------------------------------------------------------------------------------------------- LogMessage "Computer Name,IP Address,MAC Address,Primary WINS,Secondary WINS,Network Status" For i = 0 To UBound(hostNames) macAddress = "" ipAddress = "" '---------------------------------------------------------------------------------------------------------------------- 'Check the remote systems network connectivity before attempting to enumerate it's IP Configuration. '---------------------------------------------------------------------------------------------------------------------- If CheckConnection(hostNames(i)) Then If GetIPConfig(hostNames(i), ipAddress, macAddress, winsprimary, winssecondary) Then LogMessage hostNames(i) & "," & ipAddress & "," & macAddress & winsprimary & winssecondary & "," & ",Online" Else '---------------------------------------------------------------------------------------------------------------- 'The remote system responded to a WMI ping but failed to enumerate it's IP configuration. '---------------------------------------------------------------------------------------------------------------- LogMessage hostNames(i) & "," & ipAddress & "," & macAddress & winsprimary & winssecondary & "," & ",Online" End If Else '------------------------------------------------------------------------------------------------------------------- 'The remote system did not respond to WMI ping. Either it is offline or a firewall is blocking ICMP. '------------------------------------------------------------------------------------------------------------------- LogMessage hostNames(i) & "," & ipAddress & "," & macAddress & winsprimary & winssecondary & "," & ",Offline" End If NextEnd Function'----------------------------------------------------------------------------------------------------------------------------'Name : NewDictionary -> Creates a new dictionary object.'Parameters : None ->'Return : NewDictionary -> Returns a dictionary object.'----------------------------------------------------------------------------------------------------------------------------Function NewDictionary Dim dict Set dict = CreateObject("scripting.Dictionary") dict.CompareMode = vbTextCompare Set NewDictionary = dictEnd Function'----------------------------------------------------------------------------------------------------------------------------'Name : DQ -> Place double quotes around a string and replace double quotes' : -> within the string with pairs of double quotes.'Parameters : stringValue -> String value to be double quoted'Return : DQ -> Double quoted string.'----------------------------------------------------------------------------------------------------------------------------Function DQ (ByVal stringValue) If stringValue "" Then DQ = """" & Replace (stringValue, """", """""") & """" Else DQ = """""" End IfEnd Function'----------------------------------------------------------------------------------------------------------------------------'Name : CheckConnection -> Checks a remote host using WMI ping.'Parameters : hostName -> Hostname of computer system to verify network connectivity with.'Return : Boolean -> True if hostname replies. False otherwise.'----------------------------------------------------------------------------------------------------------------------------Function CheckConnection(hostName) Dim ping, response, replied Set ping = GetObject("winmgmts:impersonationLevel=impersonate").ExecQuery _ ("select * from Win32_PingStatus where address = '" & hostName & "'") For each response in ping replied = Not IsNull(response.StatusCode) And response.StatusCode = 0 Next CheckConnection = repliedEnd Function'----------------------------------------------------------------------------------------------------------------------------'Name : GetIPConfig -> Enumerates the IP & MAC Address of the system via WMI'Parameters : hostName -> String containing the computer name of the system to enumerate IP Configuration on.' : ipAddress -> Input/Output : Variable assigned to the IP Address of the system.' : macAddress -> Input/Output : Variable assigned to the MAC Address of the system.'Return : GetIPConfig -> Returns True and the systems IP & MAC Address if successful otherwise returns False.'----------------------------------------------------------------------------------------------------------------------------Function GetIPConfig(hostName, ipAddress, macAddress, winsprimary, winssecondary) Dim wmi, query, results, result GetIPConfig = False ipAddress = "" macAddress = "" winsprimary = "" winssecondary = "" query = "select * from Win32_NetworkAdapterConfiguration where IPEnabled = True" On Error Resume Next Set wmi = Getobject("winmgmts:impersonationLevel=impersonate!\\" & hostName & "\root\cimv2") If Err.Number 0 Then LogError "Creating WMI object to connect to " & DQ(hostName) Exit Function End If Set results = wmi.ExecQuery(query) If Err.Number 0 Then LogError "Executing WMI query " & DQ(query) & " on " & DQ(hostName) Exit Function End If For Each result In results ipAddress = result.IPAddress(0) macAddress = result.MACAddress(0) winsprimary = result.WINSPrimaryServer(0) winsseconday = result.WINSSecondaryServer(0) If ipAddress "" And ipAddress "" And MACAddress "" Then Exit For End If Next If Err.Number 0 Then LogError "Enumerating Network Configuration on " & DQ(hostName) Exit Function End If On Error Goto 0 GetIPConfig = TrueEnd Function'---------------------------------------------------------------------------------------------------------------------------- 'Name : GetScriptInput -> Reads a text file to be used as the scripts input into a dictionary object.' : -> Each line of the text file is added to a Dictionary object. Duplicate lines are ignored.'Parameters : results -> Input/Output : An array of unique items read from the text file.' : fileSpec -> String containing the folder path and file name of the script input file.'Return : GetScriptInput -> Returns false if the user input file is invalid else returns true.'---------------------------------------------------------------------------------------------------------------------------- Function GetScriptInput(results, fileSpec) Dim objTextFile, objDict, line GetScriptInput = False Set objDict = NewDictionary On Error Resume Next Set objTextFile = objFSO.OpenTextFile(fileSpec, ForReading) If Err.Number 0 Then BuildMessage 1, "Opening Text File " & DQ(fileSpec) Exit Function End If Do Until objTextFile.AtEndOfStream line = objTextFile.Readline If Err.Number 0 Then BuildMessage 1, "Reading a line from within the file " & DQ(fileSpec) Exit Function End If If Not objDict.Exists(line) Then objDict(objDict.Count) = line End If Loop On Error Goto 0 GetScriptInput = True results = objDict.ItemsEnd Function'----------------------------------------------------------------------------------------------------------------------------'Name : LogMessage -> Parses a message to the log file. 'Parameters: message -> String containnig the message to include in the log file.'Return : None -> '----------------------------------------------------------------------------------------------------------------------------Function LogMessage(message) If Not LogToFile(scriptLogPath & ".log", message) Then Exit Function End If End Function '----------------------------------------------------------------------------------------------------------------------------'Name : LogError -> Logs the current information about the error object.'Parameters: message -> String containnig the message that relates to the process that caused the error.'Return : None -> '----------------------------------------------------------------------------------------------------------------------------Function LogError(message) Dim errorMessage errorMessage = "Error " & Err.Number & " (Hex " & Hex(Err.Number) & ") " & message & ". " & Err.Description If Not LogToFile(scriptLogPath & ".err", errorMessage) Then Exit Function End IfEnd Function '----------------------------------------------------------------------------------------------------------------------------'Name : LogToFile -> Write a message into the user's network log file. 'Parameters : LogSpec -> String containing the Folder path, file name and extension of the log file to write to. ' : message -> String containing the Message to be logged. 'Return : LogToFile -> Returns True if successful otherwise returns false. '----------------------------------------------------------------------------------------------------------------------------Function LogToFile(logSpec, message) LogToFile = False On Error Resume Next With objFSO.OpenTextFile(logSpec, ForAppending, True) .WriteLine message .Close End With If Err.Number 0 Then Exit Function End If On Error Goto 0 LogToFile = True End Function '----------------------------------------------------------------------------------------------------------------------------'Name : PromptScriptStart -> Prompt when script starts.'Parameters : None'Return : None'----------------------------------------------------------------------------------------------------------------------------Function PromptScriptStart MsgBox "Now processing the " & DQ(Wscript.ScriptName) & " script.", vbInform

  • About

    Welcome to the group! You can connect with other members, ge...

    Group Page: Groups_SingleGroup
    bottom of page