RSS

给一个变量赋值

03 Dec

在cmd环境中给一个变量赋值,超麻烦的。

SetLocal EnableDelayedExpansion
set content=
for /F "delims=" %%i in (1.txt) do set content=!content!%%i
echo %content%
EndLocal
pause

再来看powershell,2句搞定了。

 

好久不用bat,忘记光了。

Advertisements
 
Leave a comment

Posted by on December 3, 2009 in Powershell

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: