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

  • Home
  • SEARCH
  • 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 109685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:06:30+00:00 2026-05-11T02:06:30+00:00

I tried everything possible, but still failed. I thought I got it at the

  • 0

I tried everything possible, but still failed. I thought I got it at the point which I’ll post
as my final attempt, but still isn’t good [enough].

A script is being passed three arguments. Domain name, username and password.
But the probles is that I need domain separated in ‘domain’ + ‘.com’ format. Two variables.
I tried to split it using name.extension cheat, but it doesn’t work quite well.

Check the simple code:

@echo off echo. set domain=%~n1 set ext=%~x1 echo %DOMAIN% echo %EXT% echo. 

When you try it, you get:

D:\Scripts\test>test.bat domain.com  domain .com  D:\Scripts\test>test.bat domain.co.uk  domain.co .uk 

First obviously does work, but only because I’m able to cheat my way through.
String operations in DOS Shell are a pain in the ass. I might be able to convince
a script writer to pass me 4 arguments instead of 3… but in case that fails… HELP!

  • 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. 2026-05-11T02:06:31+00:00Added an answer on May 11, 2026 at 2:06 am

    Windows ships with the Windows Scripting Host which lets you run javascript.

    Change the batch file to:

    @echo off cscript //Nologo test.js %* 

    Create test.js:

    if (WScript.Arguments.Length > 0) {     var arg = WScript.Arguments.Item(0);     var index = arg.indexOf('.');     if (index != -1) {         var domain = arg.substring(0, index);         var ext = arg.substring(index);         WScript.Echo(domain);         WScript.Echo(ext);     } else WScript.Echo('Error: Argument has no dots: ' + arg); } else WScript.Echo('Error: No argument given'); 

    And you can use it:

    C:\Documents and Settings\Waqas\Desktop>test.bat domain.com domain .com  C:\Documents and Settings\Waqas\Desktop>test.bat domain.co.uk domain .co.uk 

    And that does what I think you wanted.

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

Sidebar

Related Questions

I have tried what seems like everything - I've done similiar things many times
How can I match (PCRE) everything inbetween two tags? I tried something like this:
I recently installed MySQL 5 on Windows 2003 and tried configuring an instance. Everything
Tried to map it from Preferences -> Settings -> Keyboard, but the key combo
I tried scouring the web for help on this issue, but there are so
I tried to package a Twisted program with py2exe, but once I run the
Tried something like this: HttpApplication app = s as HttpApplication; //s is sender of
I tried to install Delphi 7 on Vista several times and Vista prevented me
I tried recently to use NAnt (beta 0.86.2962.0) to run some unit tests compiled

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.