I wan't to open up every excel file in a certain folder using the windows command prompt. I know I can do this if I know the name of each file, but I want to just open all as the file names might change. Thanks.
2 Answers
for %1 in (*.xlsx) do start excel "%%1"
In the command prompt, you can execute the above command which opens all the excel sheets in the current directory. You could store this as batch file by giving full path too
for %1 in (<path>\*.xlsx) do start excel "%%1"
Edit: As @CristiFati noted, if the excel is not there in the path,
for %1 in (<path>\*.xlsx) do "C:\Program Files (x86)\Microsoft Office\Office16\EXCEL.exe" "%%1"
-
2 comments: In order for this to work, excel's dir should be in %PATH%, and in the 2nd snippet you should use
%%1
, or better use%%f
, to avoid confusion with the 1st file argument. Aug 29, 2018 at 8:15
Navigate to the folder in command prompt.
Then run the following command
FOR %F IN (*.*) DO START %F
Credit goes to here: https://superuser.com/questions/1503993/cmd-command-to-open-all-files-in-a-subdirectory