Dec 14 2007

How to deal with long filenames in Windows Powershell

If you're new here, you may want to start with my most popular posts. Then, subscribe to my RSS feed to stay updated. Thanks for visiting!

Google Query: long filename and powershell 

I was working on a project the other day where I had to call a program from within Windows Powershell. This particular program needed command-line arguments and an input file when it was called. I wasn’t sure about the syntax of doing this in Powershell. After some Googling, I found the answer on the Microsoft Channel 9 Forums. The details are below.

-If you want to call a long filename in your Powershell script, the line looks similar to the one below (all on one line).
&'C:\Path\To\Your\Program.exe-argument1 -argument2C:\Path\To\Your\Inputfile.txt

That’s it! Once I got the proper syntax, my Powershell script ran my external program beautifully. Happy Coding!

Technorati Tags: , , ,

Related posts:

  1. How to schedule a Windows Powershell script
  2. How to send an email using a Windows Powershell script
  3. How to get past the 250 character limit on Windows file copying
  4. How to put line breaks into a text string in Windows Powershell
  5. How to redirect output when using wscript.shell in vbscript

TAGS:

LEAVE A COMMENT

Subscribe Form

Subscribe to Blog

Sponsors

Recent Readers

JOIN MY COMMUNITY!
                 
                  Computers Blogs - Blog Top Sites