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 |
if all you want is a fake G:
SUBST G: d:\actcopy will do it SUBST G: /D to delete. |
Hi Hank
Yeah i guess youre right, its as simple as that. Thanks Dave |
Hi
Tried the subst command and it didnt work..... Dave |
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 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 .... |
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 |
What error you get with subst?
|
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.
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 |
All times are GMT +1. The time now is 03:35 PM. |
© 2024 MH Sub I, LLC dba Internet Brands