.docs/Scheduling-Windows.md
# Info: https://github.com/Tyrrrz/DiscordChatExporter/blob/prime/.docs
$TOKEN = "tokenhere"
$CHANNEL = "channelhere"
$EXEPATH = "exefolderhere"
$FILENAME = "filenamehere"
$EXPORTDIRECTORY = "dirhere"
$EXPORTFORMAT = "formathere"
# Available export formats: PlainText, HtmlDark, HtmlLight, Json, Csv
cd $EXEPATH
./DiscordChatExporter.Cli export -t $TOKEN -c $CHANNEL -f $EXPORTFORMAT -o "$FILENAME.tmp"
$Date = Get-Date -Format "yyyy-MM-dd-HH-mm"
If($EXPORTFORMAT -match "PlainText"){mv "$FILENAME.tmp" -Destination "$EXPORTDIRECTORY\$FILENAME-$Date.txt"}
ElseIf($EXPORTFORMAT -match "HtmlDark"){mv "$FILENAME.tmp" -Destination "$EXPORTDIRECTORY\$FILENAME-$Date.html"}
ElseIf($EXPORTFORMAT -match "HtmlLight"){mv "$FILENAME.tmp" -Destination "$EXPORTDIRECTORY\$FILENAME-$Date.html"}
ElseIf($EXPORTFORMAT -match "Json"){mv "$FILENAME.tmp" -Destination "$EXPORTDIRECTORY\$FILENAME-$Date.json"}
ElseIf($EXPORTFORMAT -match "Csv"){mv "$FILENAME.tmp" -Destination "$EXPORTDIRECTORY\$FILENAME-$Date.csv"}
exit
tokenhere with your Tokenchannelhere with a Channel IDexefolderhere with the .exe directory's path (e.g. C:\Users\User\Desktop\DiscordChatExporter)filenamehere with a filename without spacesdirhere with the export directory (e.g. C:\Users\User\Documents\Exports)formathere with one of the available export formatsMake sure not to delete the quotes (")
filename.ps1, not as .txtNote: You can also modify the script to use other options, such as
include-threadsor switch to a different command, e. g.exportguild.
shell:startup and press ENTERfilename.ps1 or a shortcut into this folderPlease note that your computer must be turned on for the export to happen.
taskschd.msc and press ENTERTask Scheduler Library, create a Basic Task, and follow the instructions on-screenpowershell -file -ExecutionPolicy ByPass -WindowStyle Hidden "C:\path\to\filename.ps1" in the Program/script text boxSpecial thanks to @Yudi