Reputation: 13
I am trying to access a text file using batch when a user enters a certain command. I have tried doing
start E:\Programming\Important\Folder\Textfile
Cls
And it closes the cmd window but wont open the file. Does someone mind telling me what I did wrong? (sorry for the code not being in the gray box im using the web browser on phone)
Upvotes: 1
Views: 11203
Reputation: 528
You can do that easily with PowerShell, like so:
say we want to open 2 files in Sublime Text:
Start-Process -FilePath "C:\Program Files\Sublime Text 3\subl.exe" -ArgumentList D:\PathToMyFile\myFile.txt, D:\PathToMySecondFile\myFile.txt
Upvotes: 0
Reputation: 5212
I guess the problem is Textfile
has no file extension, so windows does not know how to open it. Instead of using start
you could use the notepad
command, as notepad.exe
is in the search path of the system, you can simply write:
notepad 'E:\Programming\Important\Folder\Textfile'
This will open your file.
Upvotes: 2