Opening dial-up/vpn connection via batch file?

Hi,
  I need to be able to open a dial-up connection window or VPN connection window by double clicking a batch file - can this be done?  I can't seem to find what extension a dial-up connection uses, or how to open it.

Can anyone help?

Cheers

DB
fsbsupportAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

stevenlewisCommented:
Here's how we did it
create a shortcut on the desktop, and then called the short cut from the batch file
the shortcut will have a .lnk extension
so the  batch file read
start myconnection.lnk
0
fsbsupportAuthor Commented:
Sorry but that didn't work, if I create a shortcut from a dial-up connection, it states it must be placed on the desktop but I see no file extension under Windows XP, I see all the other file extensions but nothing for this, can you think anything else?

DB
0
elbereth21Commented:
I know that connection files have the .rdp extension, I am not sure for VPN, though.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

fsbsupportAuthor Commented:
.rdp files are Remote Desktop protocol (RDP) file extensions aren't they?

DB
0
elbereth21Commented:
I am sorry, you are right.
As a second thought, you might want to create an AutoIt3 script, which will be able to create a .exe file, with which you could select the program to open automatically.
0
fsbsupportAuthor Commented:
How do I do this?

DB
0
stevenlewisCommented:
Man that worked great in 98 :-(
0
elbereth21Commented:
Before trying with AutoIt, are  you sure you tried  stevenlewis' suggestion?
Because, on Windows 2000, you cannot see any apparent extension, but the link created on the desktop is actually a .lnk file: try using 'DIR' command in a DOS shell.
0
stevenlewisCommented:
I've been messing with it on my xp pro box, and it won't run :-(
0
fsbsupportAuthor Commented:
No I can't get it to either, just seems to sit there at the DOS window!  Any help would be greatly appreciated!

DB
0
stevenlewisCommented:
I can drag the shortcut to a cmd box, and it runs ??
0
elbereth21Commented:
This is the scripting program I was talking about before:
http://www.hiddensoft.com/autoit3/
With it you can create a script which effectively simulates the CLICKS in a Windows system, as if you were doing it yourself.
I can help you with it, but I need some more details, if you think this is a viable solution.
0
stevenlewisCommented:
THIS IS MY BATCH FILE
"C:\Documents and Settings\Me\Desktop\test.lnk"
WHERE THE NAME OF THE SHORTCUT IS TEST.LNK
ooops, sorry bout the caps
Now if I double click on it, it opens and closes the cmd box, but it I drag it to a cmd box, it runs
0
elbereth21Commented:
This might be the core of the Auto it file:
Run ("C:\Documents and Settings\USERNAME\Desktop\MyLink.lnk")
WinWaitActive("Name of the connection appearing in title bar of the connection window")
Sleep(500)
Send ("!c") ;This sends ALT+c (for connect, if this is the name written on the connect button)
sleep(500)

Obviously you have to compile it to make a .exe file, which does not need any installation.
0
stevenlewisCommented:
found this
http://www.ntcompatible.com/thread29067-1.html
Create a batch file containing these three lines:

rasdial ISPname username password
"C:\Program Files\Internet Explorer\IEXPLORE.EXE"
exit


Notes:

The ISPname must match the name of your dial-up as listed in Network
Connections. username and password as per login for ISP.
0
stevenlewisCommented:
OK, got it to work
cmd /k "C:\Documents and Settings\Me\Desktop\test.lnk"
0
fsbsupportAuthor Commented:
Is there a way of saying current directory rather than having to type the entire path?  I need to do this command as a batch file for many of our staff to run and each machine will be different?

Thanks
0
elbereth21Commented:
Use %CD% in your batch file
0
elbereth21Commented:
For example cmd /k "%CD%\file.lnk"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
stevenlewisCommented:
If the batch file is placed on the desktop (the same dir as the .lnk) then you don't need the path
cmd /k test.lnk
0
fsbsupportAuthor Commented:
okay, that's working great!  What I now need to do is the following:

After the VPN connection has come up and is running, after say 30 seconds I need to use the following command:

net use X: \\192.168.0.1\sharedrive

This will then map a network drive which is on our internet VPN'd network.

Thanks

DB
0
stevenlewisCommented:
there is one problem with the /k switch, it leaves an open cmd window
0
elbereth21Commented:
Use sleep 30 if you installed resource kit
0
elbereth21Commented:
Or PING 1.1.1.1 -n 10 -w 1000 >NUL, but be sure to choose a NON-existent IP address
0
elbereth21Commented:
Stevenlewis, you can substitute /k, with /c
0
stevenlewisCommented:
the easy way is to create another batch file and tell the user to double click on it after the connection is made
0
stevenlewisCommented:
elbereth21
tried the /c switch, and it closes before executing :-(
0
fsbsupportAuthor Commented:
That's what we had been doing but we want it as simple as possible, I tried the ping routine and it doesn't work!  After the VPn connection has been both the CMD window stays open as the /C command also doesn't work and the PING command doesn't start - is there another way to sleep it for 30 seconds and then get it to launch another function/procedure?

DB
0
stevenlewisCommented:
While I don't know how to do it, I think this is more appropriate for a wsh file (windows scripting host)
you can pass alot of arguments to it that way
0
stevenlewisCommented:
/K      Carries out the command specified by string but remains
so it will not execute anything after the string
0
ZabagaRCommented:
Just FYI - in case you still need help:

I set up something VERY SIMILAR a few months ago.  I wish I read this post sooner.

I set a batch file on a few off-site machines to automatically VPN into our main server at a set time each night.
I also had the remote machines map a drive afterwards.

This was actually so I could remotely backup some data on a few servers.

Well, if you still have un-answered questions, let me know.

-z-
0
stevenlewisCommented:
???
0
elbereth21Commented:
Sorry, for being late, I was out of the office these days. Well, fsbsupport, thanks for accepting my answer, but I think it would have been better if you had split the points with stevenlewis, I am sure his suggestions helped you.
0
fsbsupportAuthor Commented:
sorry, you're right and I wanted to - I just don't know how to.....

DB
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Networking

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.