Not natively but check out: http://mridgers.github.io/clink/ , makes cmd.exe much more productive. Quoting features from the project page:
Powerful Bash-like line editing from GNU's Readline library.
Superior path completion (TAB).
Paste from clipboard (Ctrl-V).
Support for the completion of executables/commands, and environment variables.
Undo/Redo (Ctrl-_ ...
PS C:\> netstat | Select -First 20
Edit: I have a feeling that you're going to insist that you're only able to use cmd.exe circa 1989, but that's not true. Powershell is baked into every OS version Vista+, and is installable on XP/2003. It is the future of Windows.
Edit: Alright, have it your way.
C:\> netstat -an > temp.txt &&...
Powershell and WMI.
Get-WmiObject Win32_Process | Select ProcessId,CommandLine
Get-WmiObject -Query "SELECT CommandLine FROM Win32_Process WHERE ProcessID = 3352"
Note that you have to have permissions to access this information about a process. So you might have to run the command as admin if the process you want to know about is running in a ...
From the Technet article titled Manage a Server Core Server:
If you close all command prompt windows and want to open a new Command
Prompt window, press CTRL+ALT+DELETE, click Start Task Manager, click
More Details, click File, click Run, and then type cmd.exe.
Alternatively, you can log off and log back on.
You should run both commands in PowerShell as PowerShell is more than capable of manipulating environmental variables.
$dow = (get-date).dayofweek
[Environment]::SetEnvironmentVariable("DOW", $dow, "Machine")
[Environment]::SetEnvironmentVariable("DOW", $dow, "User")
By the way, your script doesn't work because all you're getting is the ...
Monitor the event logs on the domain controllers for event 672. It will show all successful logon events for AD users and which computer they logged on from. Filter by computer to get logon events for only those computers that you are interested in.
You can use the WMI subsystem, using WMIC.EXE to get to this information. Assuming a PID of 600:
wmic.exe path Win32_Process where handle='600' get name, commandline /format:list
You can also search for name, or other characteristic of the process. Use this command to list all attributes:
wmic.exe path Win32_Process get /format:list
I encountered this problem too when trying to get the details of a service where the path to the executable was very long. This discussion contains a workaround; you can pass a buffer size as an argument to sc qc. That is, if you do:
sc qc <service name> 5000
the "data area passed to a system call is too small" error goes away.
Also see SC QC MSDN ...
I believe setting the environment variable from within PowerShell with [Environment]::SetEnvironmentVariable as suggested by Dan is pointless, because you would either lose the variable's content upon the termination of PowerShell if you chose the temporary "process" context or would not have it within your batch file's environment yet if you chose the ...
The other answers are certainly good options that will serve you well in an automated system because of their command line nature (and I see from the tag that that's what you wanted). Of course, some folks might want to explore this kind of info with a GUI, so here's an alternative along those lines.
Process Explorer is a Sysinternals tool maintained by ...
To specify the interface in windows route command, you are supposed to use 'IF'... Uppercase letters, not lowercase.
Also, where you are specifying you want to add a route to a single IP 192.168.0.6, you need to use a subnet mask of 255.255.255.255.
The subnet mask of 255.255.255.255 specifies a single host. A subnet mask of 255.255.255.0 specifies 192.168....
I found an workable solution:
reg query "HKLM\System\CurrentControlSet\Services\<serviceName>" /v "ImagePath"
Of course this needs some parsing, but it gives me the full path that the services.msc dialog box provides.
Using built in tools on Windows you have a few options.
Use the regedit GUI.
Microsoft regedit provides import and export [export visible in your screenshot] options. When you export a key, it will appear in a .REG file. This is an example.
Windows Registry Editor Version 5.00
You can use clink.
Clink combines the native Windows shell cmd.exe with the powerful command line editing features of the GNU Readline library, which provides rich completion, history, and line-editing capabilities.
Easiest way to install clink is using chocolatey. Once you install chocolatey, you can install clink by typing
choco install clink
You could make a logon script and link it in Group Policy for those computers that echos %date% %time% %username% %computername% to a file on a hidden share somewhere. Then you'll have a centralized log of all logins.
By far, the easiest way to go about this is through the use of the setx command, which is included in Windows 7/Server 2008 and up, or as part of the Windows Server 2003 Resource Kit for XP and Server 2003 systems.
You can use the setx command to either specify an entirely new set of directories in the %PATH% variable, or append a value, using a little ...
You have 2 problems with your code:
1) IF only does a numeric comparison if the string on both sides evaluates to a number. Your left side is numeric, but your right side has quotes, which forces the entire comparison to be done using string semantics. Numeric digits always sort higher than a quote character, so it always reports TRUE.
As austinian ...
Start your batch:
powershell.exe -Command "Start-Process cmd -Verb RunAs"
rest of script
This will open an elevated command prompt
Keep in mind for this to work the user would need to have admin privilege on the box.
If the user is not a local admin you will have the use the /savecred switch, this is a big security hole as then the user and can ...
If you set a Scheduled Task to "Run only when user is logged on" and you are logged in as that user it will display the command window when the task is executed.
If you set it to "Run whether user is logged on or not" it will hide the command window. I'm guessing this is the option you selected. I don't think there's a way to have it display the command ...
You can do this in PowerShell with a WMI query like this:
$service = get-wmiobject -query 'select * from win32_service where name="winrm"'; echo $service.pathname
This will give you the full path, including options as they are shown in services.msc. Just replace winrm in my example with whatever service you want to search for.
The above query for winrm ...
I think using PowerShell might be the way to go.
$srcStoreScope = "CurrentUser"
$srcStoreName = "CA"
$srcStore = New-Object System.Security.Cryptography.X509Certificates.X509Store $srcStoreName, $srcStoreScope
$cert = $srcStore.certificates -match "sometext"
This should work:
route add 192.168.0.6 mask 255.255.255.0 192.168.0.254
If you want persistence:
route -p add 192.168.0.6 mask 255.255.255.0 192.168.0.254
Not sure what the "if" was for, but try this for cost:
route add 192.168.0.6 mask 255.255.255.0 192.168.0.254 metric 13