Questions tagged [windows-command-prompt]

Refers to the default CLI that ships with all versions of Windows, often shortened to just "command prompt" or cmd (after the file name of the executable).

Refers to the default CLI that ships with all versions of Windows, often shortened to just "command prompt" or cmd (after the file name of the executable).

383 questions
28
votes
13 answers

Windows command prompt: how to get the count of all files in current directory?

What command would you use in cmd.exe to find the number of files in the current directory? Is there a powershell option here? Update: I was hoping to avoid dir, as I know there are 10,000+ files in the current directory. Wanted to avoid the…
27
votes
4 answers

How to display the first N lines of a command output in Windows? (the equivalent of Unix command "head")

I need an equivalent of the Unix head command (display the first N lines of the output). This is what I'm using currently: tasklist | find /N " " | findstr /r \[[0-9]\] The above code displays the first 10 lines of tasklist's output. find /N " "…
giecsar
  • 271
  • 1
  • 3
  • 3
21
votes
7 answers

command line - switch to administrator mode

Is it possible to switch from normal mode to administrator mode in command line? I don't want to open command line by right clicking and selecting "run as administrator". Thanks
culter
  • 507
  • 2
  • 9
  • 16
21
votes
9 answers

Capturing output of remote process from sysinternal's psexec

I'm trying to capture the output of the remote process from psexec (i.e. not psexec's own output). So, for example I could run "ipconfig" and print the output to a log file. I have tried: psexec \\myserver ipconfig > output.log psexec \\myserver…
joshcomley
  • 321
  • 1
  • 4
  • 6
19
votes
2 answers

Specify route to an interface in Windows cmd

I have a computer with 2 network interfaces. One interface is connected to LAN network with IP 192.168.0.254, and the other is connected to a recorder server (192.168.0.233). 192.168.0.10 is the gateway for the LAN. When I try to ping to…
Davi GN
  • 193
  • 1
  • 1
  • 5
19
votes
6 answers

How can I get the path to a Windows service executable WITHOUT using sc qc?

I need to query a windows service for the path to it's executable via the command prompt. I think the way I would do this is:sc qc myServiceName, but when I do that, I get the following error: [SC] QueryServiceConfig FAILED 122: The data area…
Jared
  • 519
  • 1
  • 4
  • 11
17
votes
3 answers

call batch file and run using its own path/directory

I have a batch files that calls other batch files like this: e:\foo\master.bat has the content: call e:\bar\run1.bat and e:\bar\run1.bat has the content app1.exe the problem is that when I run the master.bat app1.exe will not be executed, because…
Omu
  • 337
  • 2
  • 6
  • 19
15
votes
4 answers

Is there a Windows CMD equivalent of Unix shell's exec?

Is there any equivalent in Windows to Unix Shell's "exec"? Basically, I need to avoid forking a new process, so that input/output pipes are preserved, as well as process id. Edit: So, here's my problem. I have a process A that starts a script, and…
Daniel C. Sobral
  • 5,713
  • 6
  • 34
  • 48
13
votes
4 answers

How to make the task scheduler display the cmd shell when invoking a batch file?

I am using Windows 2008 R2 and I am trying to schedule my application in the Task Scheduler. I have created a batch with the right settings. The problem I have is: I need to display the Cmd shell window (with the bat running), but the task…
Alain
  • 243
  • 1
  • 2
  • 7
11
votes
8 answers

How to remove 'Administrator:' from the command promt title

In Windows Vista, is there a way to remove the word 'Administrator:' from the title of a command prompt window? The 'title' command just updates the part after 'Administrator:', so that will not do.
10
votes
11 answers

how to get MAC address of remote computer

I have specific situation. I want to get MAC address from a remote computer, which is not in domain. I know the hostname and IP address of the remote computer. The IP Address of my computer is 192.168.2.40 and the remote computer IP is…
culter
  • 507
  • 2
  • 9
  • 16
9
votes
3 answers

How to launch a new cmd window from an existing cmd window?

Simply typing "cmd" keeps it in the same window. I'd also like to do "cmd /c command" and have it run in a separate window.
Ian Kelling
  • 2,661
  • 6
  • 23
  • 21
8
votes
1 answer

Entering local admin username and password in a script

I have alot of clients on my network and I want my script to do the following: [1] Open an elevated command prompt using the local admin details. Note: I do not want to have to enter a username and password for each user. [2] Uninstall java…
8
votes
1 answer

get AD group path in the domain/tree

How to get the path of a specific group from the Domain/tree? I am not getting to the info with the "Active Directory Users and Groups" program. We have a extensive tree of folders beneath the company.com domain. And I want to know where a specific…
8
votes
1 answer

Windows PowerShell - How to view commands history date/time

I want to list entered commands in Windows PowerShell with their respective timestamps. How can I do it with Get-History command?
1
2
3
25 26