Jump to content

Need some help with batch files


Recommended Posts

All,

I am trying to write a batch file to connect my kids' PC to mine (XP Pro on both in the same workgroup) at startup. I am aware of the syntax that should do this automatically, as listed below:

net use S: \\192.168.1.64\blobs$ /user password where user is a valid username on my PC and password is that user's pssword on my PC.

My problem however is that I do not want to reveal the password to the kids ... so I would like a script to run on their machine that connects to let's say network share blobs$ with a username and a password on my computer but NOT show them the password in the command window whist it is running. How can I do that?

I do not wish to create the same username and password that they use on their machine onto mine as I know that will work but it is also annoying to have to create an account for them since I do not intend letting them use my PC.

Many thanks for your help.

Jeff A

Link to comment
Share on other sites


The closest I can think of is using MS Script Encoder.

Create a script doing the job:

function Mount()
{
var net;
net = new ActiveXObject("WScript.Network");
net.MapNetworkDrive("S:", "\\\\192.168.1.64\\blob$","False","user","password");
close();
}

Save it as mount.js. Use the scriptencoder to encrypt it:

screnc mount.js mountenc.js

Create a hta file:

<HTML>
<HEAD>
<script LANGUAGE="JScript.Encode" >
</SCRIPT>
</HEAD>
<BODY onLoad="Mount()" >
</BODY>
</HTML>

and insert the contents of the encoded file between the <script> tags. Save as mount.hta.

Doubleclicking the .hta file should do the job.

It wouldn't surprise me if there are script decoders around on the internet, so it isn't rocksolid.

Link to comment
Share on other sites

Thanks Mijzelf.

I am new to j scripting so do bear with me.

1 I coiped the code as is from the first text box 'creating the code' in notepad and saved as 'mount.js' - I am aware that I will need to replace share name, user and password with relevant data.

2 I downloaded script encoder from the Microsoft website (sce10en.exe) and installed. Download address was

http://www.microsoft.com/downloads/details...;displaylang=en

However, I am not able to invoke script encoder from the dos promt as it tells me that 'screnc' is not a recognised as an internal or external command. Could this be because 'mount.js' is not saved in a required location - I have just saved it at the root of C currently.

3 Pre emptive question - Once I am able to encrypt 'mount.js' into 'mountenc.js', I am guessing that I need to copy and paste content of 'mountenc.js' in between the quotes on line 4 of final box </SCRIPT> - eg </ xxxxxxxxxxx> and then save the whole thing as mount.hta for example.

Kindly advise. Thanks

Jeff

Link to comment
Share on other sites

The scriptencoder is not in the path. When you installed it at it's default position you can find it at C:\Program Files\Windows Script Encoder. Copy it to system32 or to the directory where you are working, or provide a full path:

"C:\Program Files\Windows Script Encoder\screnc.exe" input output

You should put the script *between* the <script> tags:

<script LANGUAGE="JScript.Encode" >

Encrypted stuff

</SCRIPT >

Link to comment
Share on other sites

  • 3 weeks later...

course...you could create your batch file showing your pwd and you can add it to the local start up scripts using group policy

start\run\gpedit.msc

computer configuration\windows settings\scripts

just add/edit the startup script.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...