Sign in to follow this  
Followers 0
Geert

Need help with StringFormat

3 posts in this topic

I wrote a script with a simple filename-counter in it. In the output I will add this counter as a prefix for the filename:

1 shell32.dll

2 system.ini

3 explorer.exe

...

I would like to have the numbers in four digits:

0001 shell32.dll

0002 system.ini

0003 explorer.exe

0256 test.txt

...

I would like to use StringFormat but I don't know how to specify the 'format control' of the StringFormat command.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I wrote a script with a simple filename-counter in it. In the output I will add this counter as a prefix for the filename:

1 shell32.dll

2 system.ini

3 explorer.exe

...

I would like to have the numbers in four digits:

0001 shell32.dll

0002 system.ini

0003 explorer.exe

0256 test.txt

...

I would like to use StringFormat but I don't know how to specify the 'format control' of the StringFormat command.

$sFormattedFileName = StringFormat("%04d %s", $nCounter, $sFileName)
Edited by SumTingWong

Share this post


Link to post
Share on other sites

Thanks, that's what I needed!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0