- Need a "Share This Drive" batch file
- Posted by DRS.Usenet@sengsational.com on March 9th, 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--
- Posted by Pennywise@DerryMaine.gov on March 9th, 2005
On 9 Mar 2005 06:26:38 -0800, DRS.Usenet@sengsational.com 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.
--
- Posted by °Mike° on March 9th, 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
<1110378398.832717.189330@z14g2000cwz.googlegroups .com>
DRS.Usenet@sengsational.com scrawled:
--
Basic computer maintenance
http://uk.geocities.com/personel44/maintenance.html
- Posted by DRS.Usenet@sengsational.com on March 17th, 2005
°Mike° wrote:
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--