I want to be able to zip up a couple WLAN.xml files and a batch file.
Batch file will contain the commands to import those WLAN.xml's.
Can this be done directly from the zip file? Or is there a command to copy them from the zip file to a specific location (ie. c:)?
I currently have the WLAN.xml files in C:\ and my batch files specifies the location of it.
NOTE: To do this you would have to download the tool 72a.exe from 7zip, Although most computers nowadays already have it pre-installed
You can just use the following syntax:
7z a -tzip archive.zip -r src*.cpp src*.h
Apply your respective file path to the syntax above, and it should work.
Related
In a folder I have a batch file and another folder name Themes.
I would like to be able to share this with others so looking to make the source directory independent of the location of the parent.
XCOPY /E/Y "\Themes\*.thmx" "C:\Users\%username%\AppData\Roaming\Microsoft\Templates\Document Themes\"
Running the batch file returns "File not found - *.thmx"
Looking at example on WinSCP forums, I am able to put together a .bat file and associated .txt file, which works ONLY if both files are located under the same location as where WinSCP.com (and other WinSCP related files) is located:
C:\Program Files (x86)\WinSCP
Is there a way to run my .bat file successfully without having it under:
C:\Program Files (x86)\WinSCP
My .bat file content:
winscp.com /script=recon_SFTP.txt
pause
I did try moving my .bat file and .txt file to another location and adding location path, but it didn't work. I am guessing I need to escape spaces from my file path to location winscp.com?:
C:\Program Files (x86)\WinSCP\winscp.com /C:\Users\sqlservice\Desktop\SSmith1\script=recon_SFTP.txt
pause
Just use a full path to the script file after the /script= switch.
And of course, you have to quote paths that contain spaces, like the path to the Program Files (x86).
"C:\Program Files (x86)\WinSCP\winscp.com" /script="C:\Users\sqlservice\Desktop\SSmith1\recon_SFTP.txt"
Though if the .txt is in the same directory as the .bat and you execute the .bat from its folder, you do not have to use a full path to the script:
"C:\Program Files (x86)\WinSCP\winscp.com" /script=recon_SFTP.txt
Enclose any string conaining spaces that you want to be treated as a single string in "double quotes"
You could also add the WinSCP installation directory to your PATH. Then you can call winscp.com from any directory.
Add directory to path
Suppose i have a .bat file saved in a folder . When my .bat file runs i need to get the path in which this .bat file is saved . I tried Google it but could not find the answer.
Thanks.
%~dp0 will give you teh path to the bat file.
If you also need the whole path including the name of the bat file itself use %~0.
I'm using a PSFTP script to upload files to a remote server for processing and there are specific steps that I need to take with file in order for the file to be processed correctly by their system. Specifically, I have to upload the file with a ".u01" in the extension, then rename it to a ".r01". after it has been uploaded.
Is there a way to replace just the extension of the uploaded file? The rest of the filename can't be modified because the filename is corresponds with the contents of the file.
And no, I can't just upload it with a ".r" extension. Tried that already :P
The script is simple. It uploads all files from the "to_upload" directory into "ul" on the remote server:
cd ul
put -r to_upload/
We need to run a .msi file from batch file which is working fine if the path of .msi file is hard coded in batch file. Is there any way to get the path of .msi file dynamically as the batch file and .msi file exist at same folder location? It will really solve the purpose as thses needs to be copied to multiple servers...
%~dp0install.msi
%~dp0 gives you the path of your bat-file.
(note, that the last backslash is already included.
try #echo %~dp0 in your batch-file)
If the batch file and msi file are in the same folder then no path at all is needed. The batch file defaults to the current directory - and will write the log file to the current directory.
This is only an issue if the batch file is launched from a network drive.