If you have simple operations that you manually do with files on Windows operating system, you can use commands that are ordinarily used on PowerShell or Command Prompt through Subject7 using Execute_Command.
1. Get the username of the test machine and store it in a variable using Command Prompt
Windows:
cmd.exe
/c
echo %username%
macOS/Linux:
whoami
2. Extract a content of a Zip file into a folder using PowerShell
powershell.exe
Expand-Archive -LiteralPath C:\Users\USERNAME\Downloads\FILE.ZIP -DestinationPath C:\Users\USERNAME\Downloads\FOLDER
3. Get the name of a file in a specific path with an extension and store it in a variable using PowerShell
powershell.exe
get-childitem -path C:\Users\USERNAME\Downloads\FOLDER-name
4. Get the name of a specific file in a specific path without an extension and store it in a variable using PowerShell
powershell.exe
[System.IO.Path]::GetFileNameWithoutExtension('C:\Users\USERNAME\Downloads\Export\Filename.pdf')
5. Change the name and/or extension of a file to another name/extension using PowerShell
powershell.exe
Rename-Item -Path "C:\Users\USERNAME\Downloads\Export\FILE_NAME.XML" -NewName "FILE_NAME.csv"
6. Remove an empty directory using Command Prompt
cmd.exe
/c
rmdir C:\Users\USERNAME\Downloads\FOLDER
Comments
Please sign in to leave a comment.