Jump to content
Sign in to follow this  
Geert

Need help with StringFormat

Recommended Posts

Geert

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
SumTingWong

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

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.