Go Back   Tech Support Forum > Alternative Computing > Other Operating systems

User Tag List

CMD/PowerShell copy file names TWICE onto same line in text file

This is a discussion on CMD/PowerShell copy file names TWICE onto same line in text file within the Other Operating systems forums, part of the Tech Support Forum category. I need to read a directory and create a text file where the name of the first file in the


Closed Thread
 
Thread Tools Search this Thread
Old 02-22-2018, 02:48 PM   #1
Registered Member
 
NotSoGeeky's Avatar
 
Join Date: Oct 2008
Posts: 181
OS: Windows 7 Pro x64

My System


I need to read a directory and create a text file where the name of the first file in the directory is placed twice on the first line, the second file in the directory is pasted twice on the next line and so on in order to get this:

Quote:
Program.exe -i "C:\Input Folder\FILE NAME 1.ext" -o "C:\Output Folder\FILE NAME 1 .ext"
Program.exe -i "C:\Input Folder\FILE NAME 2.ext" -o "C:\Output Folder\FILE NAME 2 .ext"
Program.exe -i "C:\Input Folder\FILE NAME 3.ext" -o "C:\Output Folder\FILE NAME 3 .ext"
All help appreciated as it will save me hours of work.
NotSoGeeky is offline  
Sponsored Links
Advertisement
 
Old 02-22-2018, 04:39 PM   #2
Team Manager
Microsoft Support
 
Corday's Avatar
 
Join Date: Mar 2010
Location: Midlands of South Carolina
Posts: 26,025
OS: Windows10. In the past CP/M, DOS, Windows 95, 2000, 98SE, ME, Vista & Windows 7

My System


You wouild have to think this through using Notepad as your mechanism and possible trial and error as your medium. CMD and Notepad Codes and hacks: Code List
__________________

The stability of an OS is in direct proportion to the stability of the user.
Corday is offline  
Old 02-23-2018, 03:48 AM   #3
Moderator
Windows Tech Team
Hardware Tech Team
 
Join Date: Aug 2008
Location: INDIA
Posts: 2,976
OS: Windows 10 | CentOS | Manjaro



Are you looking to pipe this into another command or just a one time exercise ?

If it's one time, create an excel sheet and copy the filenames in one column, get the same value to the next column, use '&' command in the 3rd column including all parameters and you should have the full set in one single list.
__________________


tristar is offline  
Sponsored Links
Advertisement
 
Old 02-23-2018, 11:40 AM   #4
Registered Member
 
NotSoGeeky's Avatar
 
Join Date: Oct 2008
Posts: 181
OS: Windows 7 Pro x64

My System


Quote:
Originally Posted by tristar View Post
If it's one time, create an excel sheet and copy the filenames in one column, get the same value to the next column, use '&' command in the 3rd column including all parameters and you should have the full set in one single list.
Interesting idea. That would probably work.

I have decided to instead create a macro to do the work. It will be slower and will feel a bit sloppy by comparison, but since I will be using this process for hundreds of files (if not thousands, eventually) over numerous occasions, I suppose it is better to use a tried-and-true method that I am already comfortable with.

Thanks for the help, as always.
NotSoGeeky is offline  
Old 02-26-2018, 01:19 AM   #5
Moderator
Windows Tech Team
Hardware Tech Team
 
Join Date: Aug 2008
Location: INDIA
Posts: 2,976
OS: Windows 10 | CentOS | Manjaro



Cheers, glad to be of help :)
__________________


tristar is offline  
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Pages go to Ads - Malware or Spyware
Hello! Recently every time I try to go to a new page, it directs me to an ad page. I have tried to remove programs I do not use and do not recognize and change settings to fix automatic redirects but I have not found the problem. Very frustrating....Below is my dds.txt I tried to zip the other...
lorit999 Resolved HJT Threads 16 01-29-2014 01:15 PM
HELP - constant BSoD, freezes
Hi everyone, new to the forum, thanks in advance. I have an Acer 4810TZ laptop running Win7 home premium SP1. For a long, long time it has been freezing constantly, while also going to BSoD fairly often. For freezes, it definitely occured most often at the Windows loading screen. It also seemed...
bxm701 BSOD, App Crashes And Hangs 7 07-26-2012 06:08 AM
[SOLVED] BSOD problems.
Vista x64 What was original installed OS on system? None. Custom built. OEM: Full Retail Version Age of system (hardware): 3 years Age of OS installation - have you re-installed the OS? 3 years. Yes. CPU: Intel Core 2 Duo E8400 Wolfdale Video Card: EVGA GEforce 8800 GT...
ajcc323 BSOD, App Crashes And Hangs 25 02-24-2011 04:31 AM

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is on
Smilies are on
[IMG] code is on
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Post a Question


» Site Navigation
 > FAQ
  > 10.0.0.2
Powered by vBadvanced CMPS v3.2.3


All times are GMT -7. The time now is 01:53 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
vBulletin Security provided by vBSecurity v2.2.2 (Pro) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.1.0 (Pro) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
Copyright 2001 - 2018, Tech Support Forum

Windows 10 - Windows 7 - Windows XP - Windows Vista - Trojan Removal - Spyware Removal - Virus Removal - Networking - Security - Top Web Hosts