Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9206117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:06:29+00:00 2026-06-18T00:06:29+00:00

I am currently reading the contents of a file and returning a pattern which

  • 0

I am currently reading the contents of a file and returning a pattern which gets one line. I am able to get the correct line by itself now. How do I do a substring function on the $RunTimeLine result to return the first four characters?

[string] $RunTimeLine = Select-String -Path $IDCSwiftFlowXMLFile -pattern "<time>" | ForEach-Object {$_.Line}

OUTPUT of $RunTimeLine >>>>>>> 30 5 * * 2-6 2

I have attempted doing the following but it isn’t returning anything

$StartTime = $RunTimeLine.substring(0,4)

Any help is greatly appreciated. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:06:30+00:00Added an answer on June 18, 2026 at 12:06 am

    The String.Substring method should work IF you have a string. If you execute:

    $StartTime = $RunTime.substring(0,4)
    

    it doesn’t return anything because the result is assigned to $StartTime. What does this output:

    $StartTime
    

    If nothing then try $StartTime -eq $null. Is it possible the first four chars are whitespace so that it appears there is no output. You could check that with $StartTime.Length.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an xml file which I'm reading with php. Currently I have the
I need help reading the contents of a webpage. Currently i am using the
I currently have this file_put_contents($tmpfile, $attachments[0]['body']); $objPHPExcel = PHPExcel_IOFactory::load($tmpfile); The file I am reading
I am reading in a text file using FileInputStream that puts the file contents
I'm currently working on a project that involves a lot of text file reading.
im currently reading a book about programming Android and there is a nice little
Context I'm currently reading about Clojure's implementation of monads: org.clojure/algo.monads Intuitively, reduce looks like
I'm currently reading Rails 3 In Action. There is code that I was wondering
I'm currently reading Learning Rails 3. I'm working on an example where you can
I am currently reading Inside the C++ Object Model. On page 9 it has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.