UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Creating Batch File For Command Line Execution, windows 2013    
 
   
bakersburg9
post Sep 20 2018, 11:56 AM
Post#1



Posts: 5,260
Joined: 2-November 04
From: Downey, CA


A friend showed me a neat trick to create a list of files in a network folder from the command line:

You go to the file folder in Explorer, hold the SHIFT key and right click, and select open in command line

... then you type: dir /b>dirlist.txt

- and it creates a text file with a list of all files in the specified folder

I want to use that path to create a batch file to just run, and accomplish the same result, but this doesn't work:

CODE
"z:\_Legacy\LOSBOHSFILE01\Business-Class-Contractor-Operations\BPR OPERATIONS DATABASE\Invoice Data\2018 Invoices\Invoices Pending  Review\STEVE"dir /b>dirlist.txt


I've tried it with a space after the closing quote, and without a space, nothing works - I also don't understand why it keeps changing the drive letter - first time it was Z, second time Y, and so on

Any ideas? ... and yes, there are 2 spaces between Pending and Review

Go to the top of the page
 
theDBguy
post Sep 20 2018, 12:00 PM
Post#2


Access Wiki and Forums Moderator
Posts: 73,751
Joined: 19-June 07
From: SunnySandyEggo


Hi Steve,

Not really sure what you're trying to do with your batch file. A batch file should only contain commands, such as DIR. So, I am not sure why you're adding the path at the beginning of it. If you're trying to create a list of files in that path, then you feed it to the DIR command. For example, rather than:

c:\foldername dir /b >

you could try:

dir c:\foldername /b >

Hope it helps...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
isladogs
post Sep 20 2018, 12:01 PM
Post#3



Posts: 648
Joined: 4-June 18
From: Somerset, UK


Do you really have a folder name that starts with an underscore? "_Legacy\"
Go to the top of the page
 
bakersburg9
post Sep 20 2018, 12:34 PM
Post#4



Posts: 5,260
Joined: 2-November 04
From: Downey, CA


dbGuy,
You're saying just reverse the order, using the entire command as shown, instead of path command, do command path ?

Isla,
as for the underscore, I guess, that's what comes up when I single-click on the STEVE folder, then click on the folder icon to get the path, this is what comes up:

CODE
\\corp.MyCompanyName.com\west\_Legacy\LOSBOHSFILE01\Contractor-Operations\..BPR OPERATIONS DATABASE\Invoice Data\2018 Invoices\Invoices Pending  Review\STEVE


so yes, you can see the _Legacy - don't really get that - I hate spaces - then you've got the TWO spaces between "Pending" and "Review" ... Ugh.


Steve
Go to the top of the page
 
theDBguy
post Sep 20 2018, 12:39 PM
Post#5


Access Wiki and Forums Moderator
Posts: 73,751
Joined: 19-June 07
From: SunnySandyEggo


Hi Steve,

The DIR command lists the contents of a folder, so for example, if you were currently in the directory called C:\MyFolder, then executing DIR will list all the files inside C:\MyFolder. But, if you're in C:\MyFolder and want a list of files in C:\OtherFolder, then you would use the command DIR C:\OtherFolder.

Executing a command like C:\MyFolder DIR will probably produce an error message.

Hope it helps...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
bakersburg9
post Sep 20 2018, 01:04 PM
Post#6



Posts: 5,260
Joined: 2-November 04
From: Downey, CA


Oh, [censored]! now I have this - I repeated the lines of code, but with different letters - when I went SHIFT - right-click, it was on letter "S," which was not in my code - there's an option to disconnect - can I do that ?

?
This post has been edited by bakersburg9: Sep 20 2018, 01:05 PM
Attached File(s)
Attached File  NetworkLocations.png ( 21.03K )Number of downloads: 2
 
Go to the top of the page
 
isladogs
post Sep 20 2018, 01:56 PM
Post#7



Posts: 648
Joined: 4-June 18
From: Somerset, UK


The folder structure gets worse! Leading underscore; 2 leading dots and a double space!

\\corp.MyCompanyName.com\west\_Legacy\LOSBOHSFILE01\Contractor-Operations\..BPR OPERATIONS DATABASE\Invoice Data\2018 Invoices\Invoices Pending Review\STEVE
This post has been edited by isladogs: Sep 20 2018, 01:56 PM
Go to the top of the page
 
bakersburg9
post Sep 20 2018, 02:05 PM
Post#8



Posts: 5,260
Joined: 2-November 04
From: Downey, CA


well, I DID find something on the 'net to OPEN a directory command - maybe I could just tag onto that ?
This post has been edited by bakersburg9: Sep 20 2018, 02:25 PM
Go to the top of the page
 
bakersburg9
post Nov 2 2018, 11:50 AM
Post#9



Posts: 5,260
Joined: 2-November 04
From: Downey, CA


I'm not making myself clear - the current method is to navigate to the path/folder I want to create a list from - next step is to single-click on the folder, SHIFT=right-click, then type: dir /b>dirFileList.txt, where a text file named "FileList" will be created listing the files in the active directory - in other words, the folder I selected before the SHIFT+right-click

I want to accomplish the same thing by writing a .bat or .vbs file
Go to the top of the page
 
theDBguy
post Nov 2 2018, 12:18 PM
Post#10


Access Wiki and Forums Moderator
Posts: 73,751
Joined: 19-June 07
From: SunnySandyEggo


Hi Steve,

I would love to help you but it is still not clear to me what your intention is. You said the current process involves "navigating" to a folder. Then you said you want to "accomplish the same thing" using a script (.bat or .vbs). Is this correct, you want the script to "navigate" to some folder first?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    18th November 2018 - 10:39 PM