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 8424521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:00:57+00:00 2026-06-10T04:00:57+00:00

I have one batch file (.bat) which contains text like: osql -S %ServerName% -d

  • 0

I have one batch file (.bat) which contains text like:

osql -S %ServerName% -d %DBName% -U %sql_login% -P %sql_passwd% -n -i sp_RejectAccounts_qsel.sql -o sp_RejectAccounts_qsel.out
osql -S %ServerName% -d %DBName% -U %sql_login% -P %sql_passwd% -n -i sp_RejectAccounts_sel.sql -o sp_RejectAccounts_sel.out
osql -S %ServerName% -d %DBName% -U %sql_login% -P %sql_passwd% -n -i sp_GetCompanyRecordCardRequest_01Aug2012.sql -o sp_GetCompanyRecordCardRequest_01Aug2012.out
osql -S %ServerName% -d %DBName% -U %sql_login% -P %sql_passwd% -n -i SPGetCreditTransactions.sql -o SPGetCreditTransactions.out

I need a way to get all the .sql files in, say an array of string.
There has been some changes to the text. The regex should find .sql and then move towards the left till it finds a space.

  • 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-10T04:00:59+00:00Added an answer on June 10, 2026 at 4:00 am

    You can do like this. (i’m using List as container for the input).
    I don’t know if it works, perhaps needs abit of adjustments with the index + and -. Depending on the whitespaces.

    var a = new List<string>{"sqlplus %1/%2 < %ORACLE_CreateScriptsPath%\VersionInsertScript_Or.sql > %ORACLE_CreateScriptsPath%\VersionInsertScript_Or.out",
    "sqlplus %1/%2 <  %ORACLE_CreateScriptsPath%\Create_GT_GenerateInvoiceTxnsReportData.sql > %ORACLE_CreateScriptsPath%\Create_GT_GenerateInvoiceTxnsReportData.out",
    "sqlplus %1/%2 <  %ORACLE_CreateScriptsPath%\Create_GT_GenerateInvoiceTxnReportDataRD.sql > %ORACLE_CreateScriptsPath%\Create_GT_GenerateInvoiceTxnReportDataRD.out",
    "sqlplus %1/%2 <  %ORACLE_CreateScriptsPath%\Create_GT_GenerateTXNInvestigationReport.sql > %ORACLE_CreateScriptsPath%\Create_GT_GenerateTXNInvestigationReport.out",
    "sqlplus %1/%2 <  %ORACLE_CreateScriptsPath%\GenerateInvoiceTxnsReportData.sql > %ORACLE_CreateScriptsPath%\GenerateInvoiceTxnsReportData.out",
    "sqlplus %1/%2 <  %ORACLE_CreateScriptsPath%\GenerateInvoiceTxnReportDataRD.sql > %ORACLE_CreateScriptsPath%\GenerateInvoiceTxnReportDataRD.out"};
    
    var strings = new List<string>();
    
    foreach(var input in a)
    {
    var tmpString = input.Substring(input.IndexOf("<")+3);
    tmpString = tmpString.Remove(tmpString.IndexOf(">")-1);
    strings.Add(tmpString);
    }
    //Here you have all the SQL files accessible in the strings collection
    

    There is also a possibility to use split to get the filenames. Something like this.

    var fileNames= input.Split(" ").Where(f => f.Contains(".sql")).ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a batch file that call another one program.bat , the first
I have a batch file that is located on one machine that I am
I have an executable which is part of a batch process. This one executable
I have one drop down list in my page, which contains two options. What
Possible Duplicate: How to call one batch file after another I have a batch
i have a batch(backup.bat)file.in that i have written a command to create a backup
I have a batch file that automates copying a bunch of files from one
I have a batch file test.bat to start a powershell script: @pushd C:\myscripts powershell
I have a situation where I would like the a batch file to do
One of the first lines in a batch file I have is this: IF

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.