Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 12-17-2008, 11:48 AM   #1 (permalink)
 
Newb Techie

Join Date: Nov 2008

Posts: 6

incognito41 is on a distinguished road

Default get login in DOS

is there a DOS command for getting the login? in perl the command is "getlogin"

thanks all
incognito41 is offline  
Old 12-17-2008, 12:26 PM   #2 (permalink)
mikesgroovin's Avatar
 
HONK if you route packets

Join Date: Sep 2003

Posts: 4,664

mikesgroovin will become famous soon enoughmikesgroovin will become famous soon enough

Default Re: get login in DOS

Well depends on what you are trying to get get done. Whenever I wrote something that incorporated something to be run differently I had to use "runas" command. Check on the syntax but it's something like "runas /user:"nodename command.exe"
Basically this brings up another command prompt but is going to run it as the user you choose. If needed, it'll ask you for a password.

I used this so much for commands in windows that I got sick of typing out the whole thing so I just wrote a short perl script to do it ... Called it "su" LOL ...

But yea, using runas will allow you to run any local program either as a domain user, local user, or setup a script to do it on a foreign machine account ... You can do a lot with it
__________________
A+, Net+, Sec+, Server+, Linux+, MOUS(2000 & '03), MCSE, MCSA, MCT, CNA, CCNA, CCDA, CCNP, CCSP

Last edited by mikesgroovin; 12-17-2008 at 12:30 PM.
mikesgroovin is offline  
Old 12-17-2008, 01:58 PM   #3 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,425

office politics will become famous soon enough

Default Re: get login in DOS

PERL getlogin Function

Quote:
Syntax
getlogin



Definition and Usage
Returns the user's name, as discovered by the system function getlogin( ). Under Windows, use the Win32::LoginName( ) function instead.



in dos (running on windows), run the following

echo %username%


this will output the envirnmental variable 'username'
office politics is offline  
Old 12-17-2008, 02:25 PM   #4 (permalink)
 
Newb Techie

Join Date: Nov 2008

Posts: 6

incognito41 is on a distinguished road

Default

i'm trying to write a .bat file that automatically opens to a folder on the users account. for example the desktop. i'm using different locations, but i figure the desktop is easy and everyone has this folder.

in perl i use getlogin to assign the login to a variable then concatenate it with "explorer C:\Documents and Settings\".*username*."\Desktop" and assign to a variable. then i use that variable with the system() function.

this opens an explorer window to the desktop folder.

i'm asking about DOS because not everyone has perl on their pc.

using %username%, would i use the following command:
explorer "c:\documents and settings\%username%\desktop"

thanks for the help

%username% worked out well.

thanks!

Last edited by Mak213; 12-17-2008 at 11:10 PM.
incognito41 is offline  
Old 12-17-2008, 03:34 PM   #5 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,425

office politics will become famous soon enough

Default Re: get login in DOS

%userprofile%\desktop

may be more appropiate
office politics is offline  
Old 12-17-2008, 04:51 PM   #6 (permalink)
mikesgroovin's Avatar
 
HONK if you route packets

Join Date: Sep 2003

Posts: 4,664

mikesgroovin will become famous soon enoughmikesgroovin will become famous soon enough

Default Re: get login in DOS

Quote:
Originally Posted by incognito41 View Post
is there a DOS command for getting the login?
sorry, misunderstood your question based on how it was worded.
__________________
A+, Net+, Sec+, Server+, Linux+, MOUS(2000 & '03), MCSE, MCSA, MCT, CNA, CCNA, CCDA, CCNP, CCSP
mikesgroovin is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Login Message ehgit Computer Networking & Internet Access 3 11-18-2008 03:49 PM
DOS boot & boot.ini/MBR fix davis` Windows Operating Systems and Software 4 10-08-2008 02:54 PM
DOS Program Question jcortes Windows Operating Systems and Software 2 08-06-2008 12:41 PM
Integrating phpBB3 login on your sites Osiris Programming Discussions 1 08-05-2008 05:24 PM
Windows PC won't allow login tonyisnt Windows Operating Systems and Software 4 12-21-2007 01:33 PM