1.

Solve : Start a batch file as a different user??

Answer»

Now normally I am usually fine with this sort of thing...but I'm hitting wall here and I need help. I am trying to run one batch file from another batch file, but the batch file being ran from the other needs to be run from a different user on the network. So here is the pseudo-code.

bf1.bat
Code: [Select]@echo off
start bf2.bat as User password
bf2.bat
Code: [Select]@echo off
echo info. > Z:\file.txt
type Z:\file.txt
pause > nul
exit
It may help if you know my reasoning. Each user on the network has his/her own Z drive. The Z drive is just a mapped drive to I:\_%username%. The users have read-only priviliges on I:\_Common. Because I need write capabilities, that is not useful to me. The only place each user has read/write capabilities is on their Z drive (I:\_%username%). All the other folders in the drive have no access (so you can't access another user's Z drive). I will have a specific file on my Z drive, that I need all the users running my batch file to be able to access (with read and write). The only way to acomplish this is to run the batch file as the specific user, but is there a way to automatically do it?

Bonus points: If this is even possible it would be better. If I could keep bf2.bat in my Z drive, and the users are just running it from bf1.bat (within I:\_Common) then I wouldn't have to REALLY worry about my source and I could modify it without having someone with full read/write privilages swap it around. have you tried runas?"When prompted, type the administrator password."
The users who will be running this will not know the password (the reason for the batch file in the first place) and I can't find anything on the PAGE about auto-inputting the password.

Thanks for the idea ghostdog...we're on the right track. How many users?
Why not just deploy the file to all of your users?Quote from: Geek-9pm on January 10, 2010, 10:23:57 PM

How many users?
Why not just deploy the file to all of your users?
Same file needs to be accessed by ALL users. The content changes quite often. Quote
Same file needs to be accessed by ALL users.
The content changes quite often.

Fine. Yes you can find a way to do that.
Is this an academic CHALLENGE?
Or is this a real-world issue that needs a PIRATICAL solution?

These question are posed here because Academic challenges too often focus on a narrow area whee the students are pushed into an answer the teacher wants. But the Piratical answers are found by thinking "outside the box", metaphorically speaking.This is not an adademic challenge. It would be more "piratical" so-to-speak.
What I am attempting to do is in a way, use the Z drive as a server.


Discussion

No Comment Found