1.

Solve : Shortcut to CMD help?

Answer»

To all the DOS/CMD prompt gurus out there:

I have a shortcut to "cmd.exe" on my desktop, and I'd like it to do two things when I open it:
1 - Run a DOS command ("net use" to be exact)
2 - Change directory


I'm assuming, like most run-on-open CMD operations, that the CMD window will automatically close after it changes directories (TRY Start-->Run-->ipconfig if you want to see what I'm talking about). If your answers to numbers one and two will cause this to happen, please answer question three as well:
3 - How do I keep my CMD window up after opening a run-on-open CMD operation?





(Also, if you know of a way to accomplish this that uses something other than a desktop shortcut, like a batch file or VBmacro, that's acceptable as well - I don't care how it gets done, I just want it to get done!)From the run box you can try something like this: %comspec% /k ipconfig

where ipconfig can be any command or you can create a batch file and add a pause command at the end to keep the window open.

If you plan on writing a VBSCRIPT, use the exec method of the Script Shell object

Good luck.

It's not something I can run from the run box.


There's a script out on a network drive that I need to run under a different ID. To do this, I have a desktop shortcut to CMD that asks me what userID/pass I would like to run under.
When I run under an ID that isn't my own, I lose my drive mappings, so I must type
"net use g: \\hdcfs01\groups"
to link G: to the network drive. Then I need to type
"G:"
to change to that drive, followed by changing my directory
"cd\security\scripts\userfolders"
in that directory I have to run a script with a bunch of parameters
"cscript createfolders.vbe /user: /dest: /update"

I have to do this 5 to 8 times EVERY day, and quite frankly I'm getting tired of having to type all that crap out every time. Any suggestions?


(RUNNING XP btw...srry)Try creating a batch file with:

Code: [Select]net use g: \\hdcfs01\groups
G:
cd\security\scripts\userfolders
cscript createfolders.vbe /user:<userid> /dest:<networkdrive> /update
pause

Create a shortcut on the desktop for the batch file. Right click the shortcut and choose properties, then modify the target box by inserting runas at the beginning of the text. Runas has some parameters you can also supply in the target box. You will be prompted for the password when you run the file. Full details on runas can be found with runas /?

Maybe this will HELP. 8-)



Discussion

No Comment Found