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!
Windows ships with the Windows Scripting Host which lets you run javascript.
Change the batch file to:
Create test.js:
And you can use it:
And that does what I think you wanted.