2009/06/29

Small Skills of Command Prompt for Windows

There are some useful skills for CMD.exe in Windows.

1, How to do a substring in the CMD.exe -- %VAR_NAME:~POS,LEN%
for example
set name=fingercat
echo %name:~6,3%
This will give you a "cat" ;)

2, How to get the input of user as a string?
On windows 2000 or later. It is simple.
set /p answer=Prompt Message Here
echo %answer%
This will give you the input stirng of user.

Windows Command Prompt (.bat) file never suppose to be a powerful shell. But Microsoft really give it more an more power until a real PowerShell came into place.

没有评论:

BlockChain 相关电子书

@copyright of Sam Chadwick   - https://thehub.thomsonreuters.com/groups/bitcoin/blog/2017/09/10/blockchain-paper Blockchain Papers A c...