fsbsupport
asked on
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
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
ASKER
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
DB
I know that connection files have the .rdp extension, I am not sure for VPN, though.
ASKER
.rdp files are Remote Desktop protocol (RDP) file extensions aren't they?
DB
DB
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.
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.
ASKER
How do I do this?
DB
DB
Man that worked great in 98 :-(
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.
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.
I've been messing with it on my xp pro box, and it won't run :-(
ASKER
No I can't get it to either, just seems to sit there at the DOS window! Any help would be greatly appreciated!
DB
DB
I can drag the shortcut to a cmd box, and it runs ??
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.
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.
THIS IS MY BATCH FILE
"C:\Documents and Settings\Me\Desktop\test.l nk"
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
"C:\Documents and Settings\Me\Desktop\test.l
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
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.
Run ("C:\Documents and Settings\USERNAME\Desktop\
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.
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.
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.
OK, got it to work
cmd /k "C:\Documents and Settings\Me\Desktop\test.l nk"
cmd /k "C:\Documents and Settings\Me\Desktop\test.l
ASKER
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
Thanks
Use %CD% in your batch file
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
cmd /k test.lnk
ASKER
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
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
there is one problem with the /k switch, it leaves an open cmd window
Use sleep 30 if you installed resource kit
Or PING 1.1.1.1 -n 10 -w 1000 >NUL, but be sure to choose a NON-existent IP address
Stevenlewis, you can substitute /k, with /c
the easy way is to create another batch file and tell the user to double click on it after the connection is made
elbereth21
tried the /c switch, and it closes before executing :-(
tried the /c switch, and it closes before executing :-(
ASKER
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
DB
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
you can pass alot of arguments to it that way
/K Carries out the command specified by string but remains
so it will not execute anything after the string
so it will not execute anything after the string
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-
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-
???
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.
ASKER
sorry, you're right and I wanted to - I just don't know how to.....
DB
DB
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