There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen boot bsod computer connection crash css dell display drive driver drivers email error ethernet excel explorer firefox firefox 3 hard drive internet internet explorer itunes laptop lcd malware monitor network networking outlook outlook 2003 outlook express partition password printer problem problems ram router slow sound sprtcmd.exe trojan usb virus vista windows windows xp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
batch file


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
vkmgeek's Avatar
Junior Member with 5 posts.
 
Join Date: Jun 2006
05-Oct-2006, 03:29 AM #1
batch file
Hi,
I am writing a batch file.
My aim is to write a batch file such that it shares a folder on network. Then it waits for an hour. and then it unshares that folder. I want to put this .bat file in scheduled task.

Now I know net share is a command to share a folder. but i dont know how to wait then for an hour. and then how to unshare a folder...?

Please someone help me...

Thanks,
Jimmy the Hand's Avatar
Senior Member with 794 posts.
 
Join Date: Jul 2006
Location: Hungary
Experience: With Excel, fairly good.
05-Oct-2006, 05:05 AM #2
I don't know it either, but I think 'waiting' requires a background process. Why don't you just create another batch that unshares the folder, and put this 2nd batch file (60 mins after the first) in scheduled task, too?
vkmgeek's Avatar
Junior Member with 5 posts.
 
Join Date: Jun 2006
05-Oct-2006, 09:35 AM #3
Gr8!!
Focusing on solution...
Anyway, can do it as temporary solution, but have to find out a good solution.
Squashman's Avatar
Distinguished Member with 12,698 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
05-Oct-2006, 11:59 AM #4
A scheduled task would be about the only solution or a CRON job if you want to install CRON for windows.

Either way you are going to have to run some type of scheduled task. Or a batch file that constantly runs for an hour. You could have the batch file mark the start time in a variable, have it wait for a specified amount of time and have it check to see if 60 minutes have passed since the start time.

Not sure if this is something you could do with an AutoIT script. Johnwill would know more about that. Hopefully he stops by and checks out this thread.
__________________
I hate asking the same question twice!
How to ask questions the smart way!
Microsoft MVP - Windows Shell/User
StumpedTechy's Avatar
Distinguished Member with 6,142 posts.
 
Join Date: Jul 2004
Location: Central Florida
Experience: Advanced
05-Oct-2006, 12:46 PM #5
I know its not BAT but its simple in VBS - can you change the format or even just have the batch file call the VBS file?

Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.MapNetworkDrive "X:", "\\Server\Share", "True"
Wscript.Sleep 3600000 (this number is in milliseconds)
WshNetwork.RemoveNetworkDrive "X:", True, True
__________________
What? This doohicky goes in that thingymabob?
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 01:55 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.