Tag Info

Hot answers tagged

20

Powershell. 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 ...


15

I think this does what you are looking for PS C:\> gwmi win32_computersystem | select BootupState BootupState ----------- Normal boot http://msdn.microsoft.com/en-us/library/windows/desktop/aa394102%28v=vs.85%29.aspx Possible return values: Normal boot Fail-safe boot Fail-safe with network boot


14

Not sure there is an answer to this when using a mouse. If you wanted a command-line way to do it, you can just echo the command and pipe that output to clip: echo stuff you wanted copied to the clipboard | clip FYI, clip is available on Windows 2003. I believe it is a built-in.


11

Your terminal is outputting characters encoded using UTF-8, but PuTTY is interpreting the bytes it is seeing in another character set (probably ISO-8859-1). You can change PuTTY to use UTF-8 by changing the 'received data assumed to be in which character set' option under Window\Translation:


10

Is explorer simply not starting? have you tried typing explorer.exe in the command prompt window? I guess this isn't the case you wouldn't normally get a command prompt when logging in. It sounds like somehow the shell has been removed, effectively giving you a server core install, in which case try issuing the following from the command prompt. This should ...


9

Your PuTTY character set and your terminal character set don't match. Use echo "$LANG" and look after the period for what it should be, and set it in PuTTY.


9

Ask and ye shall receive: http://technet.microsoft.com/en-us/library/ee692796.aspx Counting the Number of Items in a Folder Well, what do you know: it looks like the sun is finally coming out, which means it’s almost time for us to go. Before we do, however, let’s show you one last little trick with the Get-ChildItem cmdlet. Sometimes ...


8

Your new user's login shell has been set to /bin/sh, which on Ubuntu is dash. This is a shell intended to be small and fast, to run scripts efficiently. It doesn't have any interactive features. Change your shell to zsh (better) or bash (more common): chsh -s /bin/bash If you want to change adduser's default shell, edit /etc/adduser.conf: ...


7

If you are a Unix type person, perhaps installing CygWin gives you a more familiar environment.


7

According to this article, an environment variable called SAFEBOOT_OPTION is set to either Minimal or Network if the system is started in Safe Mode or in Safe Mode with Networking; otherwise, the variable is unset. A test on the variable's value should do the trick; however, keep in mind that if the system is actually running in Safe Mode, it'll have no ...


6

CN=Joe Blow,OU=Office1,OU=People,DC=quang,DC=com The CN is the common name of the user. Then from left to right, list every component in the path from where the object is all the way up the tree until you come up with a fully qualified path that leads all the way up to the root of the domain. That's the distinguished name. Here's some more reading from ...


6

The method I use is to generate a color for the hostname from the hostname. There are not many colors to choose from so it will easily generate clashes, but it's useful for the small amount of machines that I manage. hostnamecolor=$(hostname | od | tr ' ' '\n' | awk '{total = total + $1}END{print 30 + (total % 6)}') ...


6

If you want to do it with cmd, then the following is the trivial way to do it: set count=0 & for %x in (*) do @(set /a count+=1 >nul) echo %count% That's assuming the command line. In a batch file you would do @echo off setlocal enableextensions set count=0 for %%x in (*) do set /a count+=1 echo %count% endlocal which does things a little nicer. ...


5

In GNU Screen, press Ctrl-a, Esc to enter copy mode, then you can use standard navigation keys to navigate around: hjkl, as well as Ctrl-f (page forward) and Ctrl-b (page back). As far as increasing your terminal's scrollback buffer, that's completely dependent on what terminal you're using. If you poke around in the settings, you're sure to find it. These ...


4

FYI, when this happened to me, I kept getting an Error 50 when using the command above. I had to add an /all to make it work. Once I did that, it worked just fine. Dism /online /enable-feature /all /featurename:Server-Gui-Mgmt /featurename:Server-Gui-Shell /featurename:ServerCore-FullServer


4

Rules in the Windows Firewall can be bundle together and activated or deactivated as a group. With netsh advfirewall command you can add rules to the Firewall. Use the switch group= for manage the AdvFirewall groups. Use something like this: netsh advfirewall firewall set rule profile=domain group="Remote Desktop" new enable=Yes


4

Two things I might try. Run an sfc /scannow to see if that fixes any larger issues at play. Check the registry for the Path key in HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment. What's the type. It should say REG_EXPAND_SZ


4

In version 5.2.3790.0 (from the W2K3 RTM support tools) you can specify a "snapshot" file: poolmon -n filename.log It will write both the paged and non-paged pool entries to this file. I'd use scheduled tasks to run the following on a recurring basis: @echo off SET POOLMON="C:\Program Files\Support Tools\Poolmon.exe" SET OUTDIR=C:\WINDOWS\TEMP SET ...


4

dir gives you the total file count at the bottom.


4

\[ and \] should only be used around parts of the command prompt that do not advance the cursor, despite having actual text. if __git_ps1 produces any visible output then this will desynchronize your command line.


3

If you start CMD with /F:ON it changes file completion to use ^F (which includes directories, while ^D does directories only) and makes Tab issue a tab character.


3

Use the call command: @echo off call MapNetworkDrive_J.cmd call MapNetworkDrive_Y.cmd


3

dir /a-d | find "File(s)" A word of warning about using PowerShell for simple file operations like this - it is incredibly slow compared to cmd.exe, especially over network connections or when there are thousands of files in the directory. See this forum post for more info.


3

You can install the XP Powertoy, or just add this to your registry Create these 2 keys: HKCR\Directory\shell\Open Command Prompt Here HKCR\Directory\shell\Open Command Prompt Here\command then set the default value for the \command key to cmd.exe /k "cd %L" You can replace "Open Command Prompt Here" with whatever you want the right-click context menu ...


3

You didn't really say what the format of the date you wanted, so I'm going by yyyymmdd. That'll probably suit sorting better as the days, months and years go on. FOR /F "tokens=2-4 delims=/ " %%a in ('echo %date%') DO SET datevar=%%c%%b%%a robocopy C:\folder\ Z:\folder_%datevar% /E /ZB /COPYALL /NP /V /LOG:F:\backup_log.txt You can change the date however ...


3

EDIT: my bad, I didn't read the KB thoroughly enough to realize it's basically useless as an answer on its own. A more useful way to determine if you're in safe mode of not is from: Microsoft® Windows® Internals: Microsoft Windows ServerTM 2003, Windows XP, and Windows 2000 by Mark E. Russinovich, David A. Solomon. The Windows kernel scans boot ...


3

Use start in your batch file. The command prompt will still flash, but else it'll run in the background: start /min C:\sigsock.exe ...


2

There is a utility call runhide a sysadmin I know uses for that kind of thing. I would probably try psexec and run the command. With psexec you can specify what session you want to run the command in (i.e. interactive session, console session, a different session so the user doesn't see the command being run, etc).


2

You're looking for subst here.


2

This do the trick on my Win7 : SET Ant=^%HOMEDRIVE^%^%HOMEPATH^%\Downloads\apache-ant-1.9.0-bin\apache-ant-1.9.0\bin setx PATH "%Ant%" /m Let's check if everything is ok : echo %Ant% %HOMEDRIVE%%HOMEPATH%\Downloads\apache-ant-1.9.0-bin\apache-ant-1.9.0\bin set | findstr Ant Ant=%HOMEDRIVE%%HOMEPATH%\Downloads\apache-ant-1.9.0-bin\apache-ant-1.9.0\bin ...



Only top voted, non community-wiki answers of a minimum length are eligible