RUN_COMMAND replace apostrophes
Hello!
I am working on a custom .gms file that needs to COPY tfw files from one location to another. Some CMD functions have syntax that need apostrophes preserved, not replaced with quotation marks. From the scripting guide: If you need to use quotation marks in your command line, instead use apostrophes (i.e. ' rather than ") and they will be converted to quotes prior to running the command.
I would like the option to preserve the apostrophe syntax in my command. For instance:
RUN_COMMAND COMMAND_LINE="cmd /C for /F %f in ('dir /b C:\Users\Desktop\old') DO COPY 'C:\Users\Desktop\old\%f' 'C:\Users\Desktop\new\%f'" WAIT_FOR_COMPLETE=YES
I am working on a custom .gms file that needs to COPY tfw files from one location to another. Some CMD functions have syntax that need apostrophes preserved, not replaced with quotation marks. From the scripting guide: If you need to use quotation marks in your command line, instead use apostrophes (i.e. ' rather than ") and they will be converted to quotes prior to running the command.
I would like the option to preserve the apostrophe syntax in my command. For instance:
RUN_COMMAND COMMAND_LINE="cmd /C for /F %f in ('dir /b C:\Users\Desktop\old') DO COPY 'C:\Users\Desktop\old\%f' 'C:\Users\Desktop\new\%f'" WAIT_FOR_COMPLETE=YES
Tagged:
Answers
-
Hello,
Have you tried putting your command into a batch file (.bat)? Then you can just run the batch file. Something like this:RUN_COMMAND COMMAND_LINE="'c:\temp\copy_files.bat'" WAIT_FOR_COMPLETE=YES
Cheers,
Bob
-
I am looking to make a "one stop shop" script to be use by my team who are not familiar with global mapper or cmd: Copying the GMS into their parent source directory, double click, and having the executable run. I do see the ".bat file" as a solution, but it would require a unique bat file for each set that cannot use the variables set up in my .gms (requires an extra step)
The paths used are set up with DEFINE_VAR, depending on where the .gms file is located
Any alternative suggestions? Maybe a more clever cmd command to COPY files that doesn't use '..' ?
Can global mapper create temp .bat files?
Thanks! -
Hello,MKaran said:
The paths used are set up with DEFINE_VAR, depending on where the .gms file is located
Any alternative suggestions? Maybe a more clever cmd command to COPY files that doesn't use '..' ?
Can global mapper create temp .bat files?
You can specify arguments when calling a batch file, which you could use to pass values that you set up using DEFINE_VAR into the batch file.RUN_COMMAND COMMAND_LINE="'c:\temp\copy_files.bat' %VAR1% %VAR2%" WAIT_FOR_COMPLETE=YES
I have opened an item (#20858) in our task list to add a new parameter to RUN_COMMAND that will preserve apostrophes in the command line. We will post a message on this thread when the status of the request changes.
Cheers,
Bob
Categories
- 12.7K All Categories
- 5.6K Features Discussion
- 342 Downloading Imagery
- 1.3K Elevation Data
- 380 Georeferencing Imagery Discussion
- 628 GM Script Language
- 53 User Scripts
- 113 GPS Features
- 414 Projection Questions
- 819 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 177 Announcement and News
- 908 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 562 Other Discussion
- 129 GIS Data Sources
- 27 Global Mapper Showcase
- 233 How I use Global Mapper
- 107 Global Mapper Forum Website