Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computing > Computer Support > Need a "Share This Drive" batch file

Reply
Thread Tools

Need a "Share This Drive" batch file

 
 
DRS.Usenet@sengsational.com
Guest
Posts: n/a
 
      03-09-2005
Okay guys, this has to be easy, but it's been so long since I used DOS
scripts....

I want to end-up with this being sent to the OS:
net share aName=c:\some\dir\that\keeps\changing

in a batch file, I know I've got "c:\some\dir\..." through the CD.

Since I don't remember syntax or even concept, I tried:
net share aName= | cd
and:
net share aName= < cd
and:
%cd%<cd
net share obc=%cd%
and:
cd|%cd%
net share obc=%cd%

And I've only shown the few of them that didn't work!

Sooooo..... WITHOUT hard-coding the path, can someone please tell me
what the batch file would look like? Even if you had to create
environment variables or even a little file.

--Dale--

 
Reply With Quote
 
 
 
 
Pennywise@DerryMaine.gov
Guest
Posts: n/a
 
      03-09-2005
On 9 Mar 2005 06:26:38 -0800, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

|> Okay guys, this has to be easy, but it's been so long since I used DOS
|> scripts....
|>
|> I want to end-up with this being sent to the OS:
|> net share aName=c:\some\dir\that\keeps\changing

Use Setx to create a variable, then using the variable with net share?

Setx.exe is included in the NT resource kit (works under XP), and as I
understand it you could create a path through a redirect from another
dos command, then use setx to create a variable from that path.

--
 
Reply With Quote
 
 
 
 
°Mike°
Guest
Posts: n/a
 
      03-09-2005
Try:

@ECHO OFF
NET SHARE aName=%1 /Y>nul

and call the batch file with the directory as a parameter.
Eg., if you named the batch file sharedrive.bat, use:

sharedrive "c:\some\dir\that\keeps\changing"


On 9 Mar 2005 06:26:38 -0800, in
<(E-Mail Removed) .com>
(E-Mail Removed) scrawled:

>Okay guys, this has to be easy, but it's been so long since I used DOS
>scripts....
>
>I want to end-up with this being sent to the OS:
>net share aName=c:\some\dir\that\keeps\changing
>
>in a batch file, I know I've got "c:\some\dir\..." through the CD.
>
>Since I don't remember syntax or even concept, I tried:
>net share aName= | cd
>and:
>net share aName= < cd
>and:
>%cd%<cd
>net share obc=%cd%
>and:
>cd|%cd%
>net share obc=%cd%
>
>And I've only shown the few of them that didn't work!
>
>Sooooo..... WITHOUT hard-coding the path, can someone please tell me
>what the batch file would look like? Even if you had to create
>environment variables or even a little file.
>
>--Dale--


--
Basic computer maintenance
http://uk.geocities.com/personel44/maintenance.html
 
Reply With Quote
 
DRS.Usenet@sengsational.com
Guest
Posts: n/a
 
      03-17-2005

°Mike° wrote:
> Try:
>
> @ECHO OFF
> NET SHARE aName=%1 /Y>nul
>
> and call the batch file with the directory as a parameter.
> Eg., if you named the batch file sharedrive.bat, use:
>
> sharedrive "c:\some\dir\that\keeps\changing"


Thanks for the idea Mike, but that's not exactly what I'm looking for.
Looking back on my post, it's not really obvious, but CD / current
directory is really the crux of it.

I didn't want to type the path... that was the whole problem. The path
literally traverses the entire screen, starting from c:> on the left.
The chances of typing that right are about nill, and I didn't want to
fiddle around with finding something in the temp folder and doing the
copy paste thing. The background is that this batch file would be
deployed (copied) to various temp folders while a program is active in
that temp folder. I wanted to be able to just drop into the temp
folder dejure (one end of the wormhole is stable, and I could reach it
using explorer), double click the batch file, then have all of my
programs that use that specific share name work.

The need actually passed by putting the main thing I needed consistent
access to up at a stable bit of directory structure... so urgency
deminished. But I'll remember to try setx.exe if the need arises
again.

--Dale--

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
batch file/jar file sihle87@gmail.com Java 2 02-16-2008 01:34 AM
How to execute Jar file using Batch file. Sriram Java 1 01-31-2008 03:59 PM
creating a file within a subdir in DOS batch file =?Utf-8?B?bWF0bHlu?= ASP .Net 0 09-20-2007 01:28 PM
Batch File - Renaming File with DATE Tom Computer Support 11 03-05-2007 10:33 PM
Compilation Batch File Won't Pipe To File Luc The Perverse Java 7 10-23-2005 10:17 AM



Advertisments