Help - Search - Members - Calendar
Full Version: CMD script help request
The CD Forum > After Hours > Rest of the World
nuMe
Is it possible to check if a particular app is running from a command script? Not a system service just a regular app. Basically is it possible to access Task Manager data from a command script?

TIA
jaclaz
Wouldn't TASKLIST do? unsure.gif

http://www.ss64.com/nt/tasklist.html

jaclaz
nuMe
Possibly if Powershell is installed. sad.gif

QUOTE
Commands marked ~ are Internal commands only available within the CMD shell, all other commands may be used under PowerShell.
jaclaz
What w00t.gif?

TASKLIST is a common command line app in XP.

Under powershell it's get-process:
http://www.ss64.com/ps/get-process.html

the snippet you got (from here):
http://www.ss64.com/nt/

QUOTE
Commands marked ~ are Internal commands only available within the CMD shell, all other commands may be used under PowerShell.
Many internal commands such as COPY and DEL are available under Powershell as cmdlets but with different syntax / options.


actually means in English:
QUOTE
You CANNOT run under powershell commands marked with ~ as they are INTERNAL commands ONLY available within the CMD shell.
All commands NOT marked by ~ are EXTERNAL commands and thus are available on BOTH CMD shell and powershell.



jaclaz
nuMe
QUOTE (jaclaz @ Dec 12 2008, 05:06 AM) *
What w00t.gif?

TASKLIST is a common command line app in XP.




Unfortunately it's not that common in XP Home.
jaclaz
Well, you never mentioned XP home.

Sure, tasklist is in XP Pro only:
http://www.tacktech.com/display.cfm?ttid=104

You may then use a third party tool, like these:
http://www.beyondlogic.org/consulting/proc...processutil.htm
http://www.teamcti.com/pview/prcview.htm

I am sure there are many others around.

jaclaz
nuMe
QUOTE (jaclaz @ Dec 12 2008, 10:25 AM) *
Well, you never mentioned XP home.

You never asked. smile.gif (And we all know what happens when one ass/u/mes something. hysterical.gif )

QUOTE

prcview's command line app, pv.exe, works perfectly. Thanks. wub.gif
MambaLeyla
I wrote this code a while back, and I was wondering if you guys would reveiw it. Basically, it lets a user change there password from a cmd window and not have to know the password to change it.

Code:echo offset /p usr=What is your name? goto program1:Program1Echo Hello usr, Welcome to Lock-Out. What would you like to do today?pauseEcho 1. Change Passwordset /p comd=Please enter the number of the task you would like to preform: If comd equ 1 goto changegoto sorry:SorryEcho Sorry, that doesnt appear to be a command.goto Program1:Changenet userset /p name=What password would you like to change?net user name pauseset /p 000=Change another Y or N? If 000 equ Y goto ChangeIf 000 equ y goto ChangeIf 000 equ N goto Program1If 000 equ n goto Program1
Ed_P
QUOTE (MambaLeyla @ Jan 7 2009, 08:49 PM) *
I wrote this code a while back, and I was wondering if you guys would reveiw it.

We would if we could read it but we can't. Can you repost it in a format that is readable?

Wrapping code text in code tags can be easily done when posting by highlighting the text then clicking on the icon.
Nuno Brito
Is ManbaLeyla's reply some sort of new age spam with a strangely unrelated topic? sign06.gif

I've wrapped his code and added some line breaks where it seems applicable although the code seems way too erroneous to work.

At the first line it seems to be asking for "usr" and then applies "user"
CODE
echo offset /p usr=What is your name?
goto program1
:Program1
Echo Hello usr, Welcome to Lock-Out. What would you like to do today?
pause
Echo 1. Change Password
set /p comd=Please enter the number of the task you would like to preform:
If comd equ 1 goto change
goto sorry
:Sorry
Echo Sorry, that doesnt appear to be a command.
goto Program1
:Change
net user
set /p name=What password would you like to change?
net user name
pause
set /p 000=Change another Y or N?
If 000 equ Y goto Change
If 000 equ y goto Change
If 000 equ N goto Program1
If 000 equ n goto Program1


Doesn't make much sense for me, I'd recommend for other people interested in trying to do it from an emulated machine to avoid bad surprises.. dry.gif
nuMe
Look familiar??

http://www.youngcoders.com/showthread.php?p=151977
CODE
@echo off

set /p usr=What is your name?  
goto program1
:Program1
Echo Hello %usr%, Welcome to Lock-Out. What would you like to do today?
pause
Echo 1. Change Password
set /p comd=Please enter the number of the task you would like to preform:  
If %comd% equ 1 goto change
goto sorry

:Sorry
Echo Sorry, that doesn't appear to be a command.
goto Program1

:Change
net user
set /p name=What password would you like to change?
net user %name% *
pause
set /p 000=Change another (Y or N)?  
If 000 equ Y goto Change
If 000 equ y goto Change
If 000 equ N goto Program1
If 000 equ n goto Program1
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.