Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Help with a .bat file

Thread Tools
 
Search this Thread
 
Old 28 April 2006, 06:43 PM
  #1  
druddle
Scooby Regular
Thread Starter
 
druddle's Avatar
 
Join Date: Mar 2001
Location: Berkshire
Posts: 5,528
Likes: 0
Received 0 Likes on 0 Posts
Default 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

Last edited by druddle; 28 April 2006 at 10:32 PM.
Old 28 April 2006, 06:51 PM
  #2  
HankScorpio
Scooby Regular
 
HankScorpio's Avatar
 
Join Date: Feb 2004
Posts: 5,848
Likes: 0
Received 0 Likes on 0 Posts
Default

if all you want is a fake G:

SUBST G: d:\actcopy
will do it

SUBST G: /D
to delete.
Old 28 April 2006, 10:30 PM
  #3  
druddle
Scooby Regular
Thread Starter
 
druddle's Avatar
 
Join Date: Mar 2001
Location: Berkshire
Posts: 5,528
Likes: 0
Received 0 Likes on 0 Posts
Default

Hi Hank

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

Thanks

Dave
Old 29 April 2006, 07:08 AM
  #4  
druddle
Scooby Regular
Thread Starter
 
druddle's Avatar
 
Join Date: Mar 2001
Location: Berkshire
Posts: 5,528
Likes: 0
Received 0 Likes on 0 Posts
Default

Hi

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

Dave
Old 29 April 2006, 08:55 AM
  #5  
prana
Scooby Regular
 
prana's Avatar
 
Join Date: Apr 2003
Location: Sydney, Aust
Posts: 341
Likes: 0
Received 0 Likes on 0 Posts
Default

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 ....
Old 29 April 2006, 09:09 PM
  #6  
druddle
Scooby Regular
Thread Starter
 
druddle's Avatar
 
Join Date: Mar 2001
Location: Berkshire
Posts: 5,528
Likes: 0
Received 0 Likes on 0 Posts
Default

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
Old 29 April 2006, 09:38 PM
  #7  
HankScorpio
Scooby Regular
 
HankScorpio's Avatar
 
Join Date: Feb 2004
Posts: 5,848
Likes: 0
Received 0 Likes on 0 Posts
Default

What error you get with subst?
Old 25 May 2006, 01:47 PM
  #8  
AVZ
Scooby Regular
 
AVZ's Avatar
 
Join Date: May 2006
Posts: 213
Likes: 0
Received 0 Likes on 0 Posts
Default

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
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Nick_Cat
Computer & Technology Related
2
26 September 2015 08:00 AM
Littleted
Computer & Technology Related
0
25 September 2015 08:44 AM
ALi-B
Computer & Technology Related
0
14 September 2015 07:49 AM
riiidaa
ScoobyNet General
1
12 September 2015 11:52 AM
hooksin
ScoobyNet General
8
02 January 2001 03:47 PM



Quick Reply: Help with a .bat file



All times are GMT +1. The time now is 07:32 PM.