Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6254675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:13:20+00:00 2026-05-24T14:13:20+00:00

I am working with PowerShell to create a renaming script for a number of

  • 0

I am working with PowerShell to create a renaming script for a number of files in a directory.

Two questions here:

I have a string variable $strPrefix = "ACV-100-" and an integer counter $intInc = 000001 and I wish to increment the counter $intInc 1 -> 2 and then concatenate the two and store it in a variable $strCPrefix in the following format: ACV-100-000002.

I believe the $intInc will need to be cast in order to convert it once incrementing is complete but I am unsure how to do this.

Secondly, I have found that the script will display 000001 as 1, 000101 as 101 and so on… I need the full 6 digits to be displayed as this will form a file name. How do I keep or pad the numbers before I process the concatenation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T14:13:21+00:00Added an answer on May 24, 2026 at 2:13 pm
    $intInc = 1
    
    $strCprefix = $strprefix + "{0:000000}" -f $intInc # give ACV-100-000001
    

    hope can help

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple PowerShell script that uses WMI to create a web site
I'm trying to get this simple PowerShell script working, but I think something is
Slowly learning Powershell ... I'm working on a script to query a third party
I'm working with csproj files using Powershell to perform large-scale editing of project references.
Working on a project at the moment and we have to implement soft deletion
I am creating a new object in a Powershell script, or actually an object
Working on a simple helper function in PowerShell that takes a couple of parameters
I'm rather new to Powershell and am working on setting up my profile.ps1 file.
Working through Jerry Lee Ford Jr.'s Powershell 2.0 for the Absolute Beginner book. There's
I have a script that appends some rows to a table. One of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.