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
Page 1 of 1
Need some help with batch files Need some help with batch files
#2
Posted 08 July 2009 - 02:51 AM
The closest I can think of is using MS Script Encoder.
Create a script doing the job:
Create a hta file:
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.
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.
#3
Posted 08 July 2009 - 03:22 AM
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
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
#4
Posted 08 July 2009 - 03:40 AM
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 >
"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 >
#5
Posted 23 July 2009 - 10:39 AM
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.
start\run\gpedit.msc
computer configuration\windows settings\scripts
just add/edit the startup script.
- ← pthread library on 64 bit windows
- Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
- Else statements for MS-DOS? →
Share this topic:
Page 1 of 1



Help
Back to top









