Command to run specific file

February 12, 2010 at 08:18:57
Specs: Windows XP, 2/1g
@echo off

IF EXIST New\*.ppsx  MOVE Running\*.ppsx Old\
IF EXIST New\*.ppsx  MOVE New\*.ppsx Running\
START Running\test.ppsx

Batch runs at when loading windows on a remote coputer and feeds .ppsx (powerpoint) to an infoscreen at the schools auditorium.

Everything works perfect exept when a teacher put's a new "ppsx" document in the "New" folder it gets copyed to the "Running" (running) folder.

The script will naturally only run the new "ppsx" if it is named "test" so what i need is a command wich will run the content of the "Running" directory no matter what the .ppsx file in the folder is named..

Thanks in advance "Norwegian noobie"


See More: Command to run specific file

Report •

#1
February 12, 2010 at 09:38:07
"what i need is a command wich will run the content of the "Running" directory no matter what the .ppsx file in the folder is named.."


------------------------------


@echo off & setLocal EnableDELAYedeXpansion

pushd Running

for /f "tokens=* delims= " %%a in ('dir/b *.ppsx') do (
start "%%a"
)


=====================================
Helping others achieve escape felicity

M2


Report •

#2
February 14, 2010 at 04:49:37
hi, tnx.. but since im a noob i don't understad what your code does, (do i just copy paste?) care to explain?

@echo off & setLocal EnableDELAYedeXpansion

pushd Running

for /f "tokens=* delims= " %%a in ('dir/b *.ppsx') do (
start "%%a"
)



What does EnableDELAYedeXpansion do?
what will the full script look like when i have implemented your contribution?

Report •

#3
February 14, 2010 at 05:00:41
for /f "tokens=* delims= " %%a in ('dir/b *.ppsx') do (
start "%%a"
)

It lists the files in the current directory, matching *.ppsx, then performs : "start <filename>" with each occurance.

In my opinion, it may be better to add the program, example:

for /f "tokens=* delims= " %%a in ('dir/b *.ppsx') do (
start "dummy" "C:\program files\something\something.exe" "%%a"
)


Report •

Related Solutions

#4
February 14, 2010 at 05:03:18
> What does EnableDELAYedeXpansion do?
>

In the above code, it'll do exactly nothing ... check out the meaning of it via "FOR /?", and check the "FOR /F" section ... you NEED it in some cases ...


Report •

Ask Question