ScoobyNet.com - Subaru Enthusiast Forum

ScoobyNet.com - Subaru Enthusiast Forum (https://www.scoobynet.com/)
-   Computer & Technology Related (https://www.scoobynet.com/computer-and-technology-related-34/)
-   -   Help with a .bat file (https://www.scoobynet.com/computer-and-technology-related-34/511459-help-with-a-bat-file.html)

druddle 28 April 2006 06:43 PM

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

HankScorpio 28 April 2006 06:51 PM

if all you want is a fake G:

SUBST G: d:\actcopy
will do it

SUBST G: /D
to delete.

druddle 28 April 2006 10:30 PM

Hi Hank

Yeah i guess youre right, its as simple as that.

Thanks

Dave

druddle 29 April 2006 07:08 AM

Hi

Tried the subst command and it didnt work.....

Dave

prana 29 April 2006 08:55 AM

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.
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 ....

druddle 29 April 2006 09:09 PM

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

HankScorpio 29 April 2006 09:38 PM

What error you get with subst?

AVZ 25 May 2006 01:47 PM

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