Help with a .bat file
#1
Scooby Regular
Thread Starter
Join Date: Mar 2001
Location: Berkshire
Posts: 5,528
Likes: 0
Received 0 Likes
on
0 Posts
Help with a .bat file
Hello
My brother in law has his own company. He has a server in his office that has a database on it, that is shared to his laptop when he is connected to the office LAN. The laptop maps it as drive G and connects to the database files with a client.
He does a daily copy of the database files onto his laptop into a folder (D:\actsharecopy) so that he can use the database when not on the network. He has recently had the laptop reinstalled to go from Win2k to Xp, and didnt save a .bat file he uses for the database client. Basically, when he is not on his office LAN, the .bat file mapped the directory he copied the database files to G on the laptop, so the client didnt know that it is not connected to the server.
I dont know MS batch file syntax, so can anyone help me create one that will do what he wants ? He said it used to start with...
net use G:
if thats any help....
Thanks in advance.
Dave
My brother in law has his own company. He has a server in his office that has a database on it, that is shared to his laptop when he is connected to the office LAN. The laptop maps it as drive G and connects to the database files with a client.
He does a daily copy of the database files onto his laptop into a folder (D:\actsharecopy) so that he can use the database when not on the network. He has recently had the laptop reinstalled to go from Win2k to Xp, and didnt save a .bat file he uses for the database client. Basically, when he is not on his office LAN, the .bat file mapped the directory he copied the database files to G on the laptop, so the client didnt know that it is not connected to the server.
I dont know MS batch file syntax, so can anyone help me create one that will do what he wants ? He said it used to start with...
net use G:
if thats any help....
Thanks in advance.
Dave
Last edited by druddle; 28 April 2006 at 10:32 PM.
#5
Scooby Regular
Join Date: Apr 2003
Location: Sydney, Aust
Posts: 341
Likes: 0
Received 0 Likes
on
0 Posts
I am not very clear on what you want, but thats probably just my english.
But this may be what you want then
net use G: /delete
net use G: \\computername\sharefolder password "/user:"
although I highly encourage not putting your password there.
so probably best net use G: \\computername\sharefolder * /user:
or if anonymous share
net use G: \\computername\sharefolder
I am really confused by what you said there, so I would guess you want to create an offline syncrhronised folder on G: ? Then just map your drive as G:, then right click on explorer, and choose ' Make Available Offline ' then you can update, etc
Otherwise, you want to just copy G: to D: then just
net use G: \\comp\share
copy G:\blah.database C:\pathto\blah.database //something of this sort maybe ?
but like I said, I dont really understand what you wanted so not sure if this is any relevant or helpful to you ....
But this may be what you want then
net use G: /delete
net use G: \\computername\sharefolder password "/user:"
although I highly encourage not putting your password there.
so probably best net use G: \\computername\sharefolder * /user:
or if anonymous share
net use G: \\computername\sharefolder
He does a daily copy of the database files onto his laptop into a folder (D:\actsharecopy) so that he can use the database when not on the network. He has recently had the laptop reinstalled to go from Win2k to Xp, and didnt save a .bat file he uses for the database client. Basically, when he is not on his office LAN, the .bat file mapped the directory he copied the database files to G on the laptop, so the client didnt know that it is not connected to the server.
Otherwise, you want to just copy G: to D: then just
net use G: \\comp\share
copy G:\blah.database C:\pathto\blah.database //something of this sort maybe ?
but like I said, I dont really understand what you wanted so not sure if this is any relevant or helpful to you ....
#6
Scooby Regular
Thread Starter
Join Date: Mar 2001
Location: Berkshire
Posts: 5,528
Likes: 0
Received 0 Likes
on
0 Posts
Hi prana
Basically when he is in the office, the G drive is mapped to a server where the database files are. When he is out of the office, he wants to the G drive to map to D:\actsharecopy where a copy of the database files live, so that his database client application cant tell that he is not connected to the server files when he is running off the local files.
Dave
Basically when he is in the office, the G drive is mapped to a server where the database files are. When he is out of the office, he wants to the G drive to map to D:\actsharecopy where a copy of the database files live, so that his database client application cant tell that he is not connected to the server files when he is running off the local files.
Dave
Trending Topics
#8
A Basic way to do this is to create two Batch files... one called "in office" the outher called "out of office".
First one make it have
net use G: /delete
net use G: \\computername\sharefolder
To make it more secure dont put the line for username and password. Enter these each time he executes the script.
Second one make
net use G: /delete
net use G: \\computername\sharefolder
Hope it helps....
If you are having problems PM with the details of the servername and sharenames and i will do it for you.
First one make it have
net use G: /delete
net use G: \\computername\sharefolder
To make it more secure dont put the line for username and password. Enter these each time he executes the script.
Second one make
net use G: /delete
net use G: \\computername\sharefolder
Hope it helps....
If you are having problems PM with the details of the servername and sharenames and i will do it for you.
Originally Posted by druddle
Hi prana
Basically when he is in the office, the G drive is mapped to a server where the database files are. When he is out of the office, he wants to the G drive to map to D:\actsharecopy where a copy of the database files live, so that his database client application cant tell that he is not connected to the server files when he is running off the local files.
Dave
Basically when he is in the office, the G drive is mapped to a server where the database files are. When he is out of the office, he wants to the G drive to map to D:\actsharecopy where a copy of the database files live, so that his database client application cant tell that he is not connected to the server files when he is running off the local files.
Dave
Thread
Thread Starter
Forum
Replies
Last Post