0

I want to make a shortcut, having this command

timeout 10 & rem 1

The command simply time outs in 10 seconds and then do whatever is in the next command (here rem is a comment, ie it does nothing)

While it works as a command directly in CMD if I put the same in LNK file, it does not. I'm used to LNK files so this is strange.

The same LNK file resolves to this error:

ERROR: Invalid syntax. Default option is not allowed more than '1' time(s). Type "TIMEOUT /?" for usage.

BenGee23
  • 43
  • 6
  • 1
    The `&` is a `cmd` feature. – Raymond Chen May 05 '23 at 14:30
  • yes, and this is intended to separate timeout parameters from the next commands. It does work on console but not on the shortcut – BenGee23 May 05 '23 at 14:56
  • 1
    Right. So you have to pass the command line to`cmd` because it is `cmd` that understands what `&` means – Raymond Chen May 05 '23 at 14:59
  • I got your point. So I'm bound to timeout, as the only starting point. and from then I cannot go to CMD. Probably I should do it the opposite way ! – BenGee23 May 05 '23 at 15:07
  • 2
    The shortcut would required the property __Target__ as `%SystemRoot%\System32\cmd.exe /D /C %SystemRoot%\System32\timeout.exe /T 10 & rem 1`. Please open a [command prompt](https://www.howtogeek.com/235101/), run `cmd /?` and read the output usage help and next `timeout /?` and `rem /?` and read also the output usage helps for the other two [Windows commands](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands). See also [single line with multiple commands](https://stackoverflow.com/a/25344009/3074564). – Mofi May 06 '23 at 08:17

0 Answers0