Skip to content

Instantly share code, notes, and snippets.

@dvgamerr
Last active July 31, 2018 03:34
Show Gist options
  • Save dvgamerr/c4c65ec967c1026e4c7ff593a800713e to your computer and use it in GitHub Desktop.
Save dvgamerr/c4c65ec967c1026e4c7ff593a800713e to your computer and use it in GitHub Desktop.
Commaneline

%0 - the command used to call the batch file (could be foo, ..\foo, c:\bats\foo.bat, etc.) %1 is the first command line parameter, %2 is the second command line parameter, and so on till %9 (and SHIFT can be used for those after the 9th).

%~nx0 - the actual name of the batch file, regardless of calling method (some-batch.bat) %~dp0 - drive and path to the script (d:\scripts %~dpnx0 - is the fully qualified path name of the script (d:\scripts\some-batch.bat)

More info examples at http://www.ss64.com/nt/syntax-args.html

powerShell

param([Int32]$step=30) #Must be the first statement in your script

$iTunes = New-Object -ComObject iTunes.Application

if ($iTunes.playerstate -eq 1)
{
  $iTunes.PlayerPosition = $iTunes.PlayerPosition + $step
}

Call it with

powershell.exe -file itunesForward.ps1 -step 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment